Care must be taken when using the lastInsertId method with the SQLite database, as all SQLite tables
possess a hidden record id column to which the lastInsertId method returns. If you choose to include
your own record id column, as carried out in the previous examples, you must facilitate your own id
retrieval functionality. If, however, you choose to use the hidden record id column, you can include this
column in your own SQL strings by referencing the column as either ROWID , _ROWID_ , or OID .
Transactions
Transactions provide a great way to ensure data integrity when inserting, updating, or deleting multiple
records. For example, if you need to insert or update two tables at once, and need to guarantee that
either both SQL executions are successful or both are unsuccessful, then you can perform the executions
within a transaction and commit the transaction only if both are successful; otherwise you roll the
transaction back to its previous state.
282
Part II: Server Side, JavaScript, and Flash: Oh My!
At the time of this writing, the Connection class provides full transactional capabilities for all current
databases accessible by the haXe language.
Pages:
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553