Prev | Current Page 572 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The point to take note of is that the data
is called through the instance of the Author class, not the Chapter class:
import Author;
class AuthorChapterApp
{
public static function main()
{
var dbloc = ???Wrox.db3???;
getAuthor( dbloc );
}
public static function getAuthor( loc : String )
{
var conn = neko.db.Sqlite.open( loc );
neko.db.Manager.cnx = conn;
neko.db.Manager.initialize();
// get the author with the id value 1
var u = Author.manager.get(1);
if( u != null )
{
if( u.chapter == null )
{
var c = new Chapter();
// populate new chapter
c.int_chapter = 11;
c.var_title = ???Server Side Trickery???;
c.insert();
u.chapter = c;
u.update();
neko.Lib.print( ???chapter updated??? );
} else {
neko.Lib.print( ???chapter : ??? + u.chapter.int_chapter + ???, ???
+ u.chapter.var_title );
}
// close the connection
neko.db.Manager.cleanup();
conn.close();
}
}
}
The RELATIONS () Method
The static RELATIONS method provides one purpose; to return an array containing objects detailing the
relationship between the table represented by the method ??™ s parent class and other tables represented by
other objects extending the neko.


Pages:
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584