Prev | Current Page 552 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

With each use of the
SPOD, you will always require at least one class that extends the neko.db.Object class and one that
either is or extends the neko.db.Manager class. The following example shows how the neko.db
.Object class might be extended.
Simple Use of the SPOD System
This is the class that maps to the Author database table:
class Author extends neko.db.Object
{
// field reference variables
public var int_id : Int;
public var var_username : String;
public var var_password : String;
public var var_email : String;
public var dte_added : Date;
// associated table name
static var TABLE_NAME = ???Author???;
// associated table id field
static var TABLE_IDS = [???int_id???];
// manager for this class
public static var manager = new neko.db.Manager < Author > (Author);
}
And the application class that consumes it:
import Author;
class AuthorApp
{
public static function main()
{
var dbloc = ???Wrox.db3???;
getAuthor( dbloc );
}
public static function getAuthor( loc : String )
{
var conn = neko.


Pages:
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564