in reply to Re^16: CGI Action call
in thread CGI Action call

Based on record suggestion with Zimmerman I added multiple records with same last name.

The previous and next hit the first one then skip the rest. Tried concatenating other fields but that did not work. Nothing I looked at preserved the order.

Am looking into cursors and stored procedures or stored functions.

Sending the unique record id to the procedure which would return the unique record number of the next record the cursor was pointing to after a fetch would be used to load that record into the form.

Update or insert would not involve the SP. That would only be called when scrolling

This is continent on finding out if the curso/fetch honors the ORDER since it only recognizes moving cursor "forward".

Replies are listed 'Best First'.
Re^18: CGI Action call
by poj (Abbot) on Mar 30, 2018 at 11:20 UTC

    I anticipated this problem when I posted Re^3: CGI Action call.

    Am looking into cursors and stored procedures or stored functions.

    Not sure you need that complexity, you probably just need to use an OFFSET in your LIMIT statement. If you describe how you are persisting the sort order now that you are not using ALTER TABLE ORDER BY I may be able to suggest a solution.

    poj
Re^18: CGI Action call
by tultalk (Monk) on Mar 30, 2018 at 18:37 UTC

    Have you ever seen this from My SQL manual?>

    HANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST } [ WHERE where_condition ] [LIMIT ... ]

    GAD!!!Works perfectly

    HANDLER users OPEN HANDLER users READ business last
      Have you ever seen this from My SQL manual ?
      The HANDLER ... OPEN statement opens a table, making it accessible using subsequent HANDLER ... READ statements. This table object is not shared by other sessions and is not closed until the session calls HANDLER ... CLOSE or the session terminates.

        Worse yet it does not maintain the state during subsequent calls

        Each subsequent all to NEXT returns the same record, the first one

        I guess the table closes after the sub completes executing

        I had hoped it was open until an explicit call to close or "program" termination but them as with always, each call to a sub is separate

        Back to working on maintaining state as I was trying before. My only problem there was skipping same last names.

        Re-invent wheel again

        But you can lock the table while open correect?