Prev | Current Page 562 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


The sync() Method
While the update method provides a means to synchronize data by submitting changes from the object
to the database, the sync method provides the same facility, only in reverse. When called, the object will
be repopulated with data from its associated record, overwriting any changes made since its last
synchronization. This is very handy should your object contain dirty data (data not yet committed to the
database) that you do not want persisted.
Another use for this method is when inserting data into a table that provides default values. If, when
manually populating your object, you choose to leave some data population to the database, any call to
the insert method will still mean that those unmodified fields contain a null value, even if your newly
inserted record does not. Calling the sync method at such times will populate in the reverse direction,
ensuring that object and record contain complete and identical values.
The neko.db.Manager Class
The neko.db.Manager class provides an extensive array of tools for dealing with object mapped
database tables beyond what you ??™ ve already seen.


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