Prev | Current Page 561 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


Upon modifying data contained in the object, you can update the database to match the content by
calling the update method.
Both the update and delete methods require that the object in question has already received data from
the database. If not, then a missing key exception is thrown, as, even if you have prepopulated the object
yourself, the unique id for that object would not be available. Also, any call to update requires that the
original object be already in the Manager data cache, so it can iterate through all available fields and
update only the data that has been modified since it was last synchronized with the database.
The insert method will work regardless of whether the object contains data from the database, or data
you have manually entered. If you do not manually enter a value for the unique key, then it will be
automatically populated after the insert using the lastInsertedId method for that table. At the same
time, if you are inserting from an object that already contains a valid identifier from an existing record,
you should set the value to null before calling the insert method, so that the value used is that of an
automatic increment of the largest valid identifier and ensuring the insert is more likely to succeed.


Pages:
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573