Prev | Current Page 575 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

Now, normally you ??™ d imagine this to cause some sort of
infinite loop, with records everywhere calling each other. However, despite the number of references to a
single record, providing each record possesses a unique id, the SPOD framework will only ever store one
instance of each record in memory, thus providing the perfect relational object mapping.
As always, all of this will be better understood within an example. Assuming you want to create the
many - to - many relationship, you first need to create a lookup table to link the Author and Chapter
tables:
class CreateLookupTable
{
public static function main()
{
var dbLoc : String = ???Wrox.db3???;
var dbFactory = create( dbLoc );
}
public static function create( loc : String )
{
var cnx = neko.db.Sqlite.open( loc );
299
Chapter 11: Performing Server-Side Trickery
cnx.request( ???CREATE TABLE Lookup (
int_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
int_author INTEGER NOT NULL,
int_chapter INTEGER NOT NULL )??? );
cnx.request( ???INSERT INTO Lookup (
int_author, int_chapter ) VALUES (
1, 1 )??? );
cnx.


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