Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Question regarding sequence numbers

    Hello-

    I have an operation where I would like to be able to retrieve sequence numbers for records created on the client side before saving the records to the mysql database. Is there a way to do this?

    Based on a user's selection of records, I am creating new records in a different table with subrecords that are linked via a foreign key. None of the records or subrecords get committed to the database until the user approves the new records. I would like to do as much as possible on the client side and avoid creating records that might later have to be deleted. I am just in the pseudocode phase, but the problem I am coming up with is that I will have to have created the new records to retrieve the primary key sequence numbers from mysql in order to assign them to the subrecords. I would like to avoid creating the records until they are ready to be commited.

    Alternatively, I'm not clear as to how to control mysql transactions from SmartGWT.

    Thank you for your help.
    Last edited by sedmands; 22 Sep 2010, 12:03.

    #2
    In Oracle and other DBs with truly separate sequences, you could use a <customSQL> block to just get the next sequence number. In MySQL you could create a dedicated separate table to act similar to Oracle's independent sequences, or you could insert a new record into a table that has a sequence column but just mark it as "inactive" or similar, ignoring such records for normal queries.

    Transactions are on by default for Power edition for MySQL and other DBs - see RPCManager.setTransactionPolicy() and related APIs.

    Comment

    Working...
    X