Prev | Current Page 568 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

db.Manager < Author > {
public function new() {
super( Author );
}
public function getByEmail( email : String ) {
return objects(select(???var_email = ???+quote( email ) ), true );
}
}
By supplying various methods to the extended Manager class, you are in affect creating application -
based stored procedures. This is a very handy feature when using a database with limited capabilities,
such as a SQLite database.
(continued)
295
Chapter 11: Performing Server-Side Trickery
make() and unmake()
The make and unmake methods are override - able functions for use in extensions of the neko
.db.Manager class. The make method is called when a returned SPOD object is created following data
retrieval from the database, while the unmake method is called just before an update is made. Using both
methods together, you can purposely perform calculations on data retrieved from the database so as to
make the data more object friendly, while using the unmake method to reparse the data for saving back
to the database:
class AuthorManager extends neko.


Pages:
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580