-------------------------------------------------------------------------------------------------------------------
Preparing database using SQL queries (creating 'people', 'children')
Inserting person in 'people' table ('John Lim, he likes lavender')
-------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
person->Find('id=1') [Lazy Method]
person is loaded but its children will be loaded on-demand later on
-------------------------------------------------------------------------------------------------------------------
[OK] Found John
[OK] No relation yet
-- Lazily Loading Children:
[OK] Found relation: child
[OK] Found Joan
[OK] Found JAMIE
-------------------------------------------------------------------------------------------------------------------
person->Find('id=1' ... ADODB_WORK_AR) [Worker Method]
person is loaded, and so are its children
-------------------------------------------------------------------------------------------------------------------
[OK] Found John
[OK] Found relation: child
[OK] Found Joan
[OK] Found JAMIE
-------------------------------------------------------------------------------------------------------------------
person->Find('id=1' ... ADODB_JOIN_AR) [Join Method]
person and its children are loaded using a single query
-------------------------------------------------------------------------------------------------------------------
[OK] Found John
[OK] Found relation: child
[OK] Found Joan
[OK] Found JAMIE
-------------------------------------------------------------------------------------------------------------------
person->Load('people.id=1') [Join Method]
Load() always uses the join method since it returns only one row
-------------------------------------------------------------------------------------------------------------------
[OK] Found John
[OK] Found relation: child
[OK] Found Joan
[OK] Found JAMIE
-------------------------------------------------------------------------------------------------------------------
child->Load('children.id=1') [Join Method]
We are now loading from the 'children' table, not from 'people'
-------------------------------------------------------------------------------------------------------------------
[OK] Found Jill
[OK] Found relation: person
-------------------------------------------------------------------------------------------------------------------
child->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]
-------------------------------------------------------------------------------------------------------------------
[OK] Found Jill
[OK] Found relation: person
[OK] No Joan relation
[OK] No JAMIE relation
-------------------------------------------------------------------------------------------------------------------
kid->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]
Where we see that kid shares relationships with child because they are stored
in the common table's metadata structure.
-------------------------------------------------------------------------------------------------------------------
[OK] Found Jill
[OK] Found relation: person
[OK] No Joan relation
[OK] No JAMIE relation
-------------------------------------------------------------------------------------------------------------------
kid->Find('children.id=1' ... ADODB_LAZY_AR) [Lazy Method]
Of course, lazy loading also retrieve medata information...
-------------------------------------------------------------------------------------------------------------------
[OK] Found Jill
[OK] No relation yet
-- Lazily Loading People:
[OK] Found relation: person
[OK] No Joan relation
[OK] No JAMIE relation
-------------------------------------------------------------------------------------------------------------------
rugrat->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]
In rugrat's constructor it is specified that
it must forget any existing relation
-------------------------------------------------------------------------------------------------------------------
[OK] Found Jill
[OK] No relation found
[OK] No Joan relation
[OK] No JAMIE relation
-------------------------------------------------------------------------------------------------------------------
kid->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]
Note how only rugrat forgot its relations - kid is fine.
-------------------------------------------------------------------------------------------------------------------
[OK] Found Jill
[OK] I did not forget relation: person
[OK] No Joan relation
[OK] No JAMIE relation
-------------------------------------------------------------------------------------------------------------------
rugrat->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]
-------------------------------------------------------------------------------------------------------------------
[OK] Found Jill
[OK] No relation yet
-- Loading relations:
[OK] Found relation: person
[OK] Found Jill
[OK] No Joan relation
[OK] No Joan relation
-------------------------------------------------------------------------------------------------------------------
person->Find('1=1') [Lazy Method]
And now for our finale...
-------------------------------------------------------------------------------------------------------------------
[OK] Found John
[OK] No relation yet
[OK] No Fluffy yet
-- Lazily Loading Everybody:
[OK] Found relation: child
[OK] Found Joan
[OK] Found JAMIE
[OK] Found Cat Lady
[OK] Found Fluffy
[OK] Found Sun
-------------------------------------------------------------------------------------------------------------------
artist->Load('artistuniqueid=1') [Join Method]
Yes, we are dabbling in the musical field now..
-------------------------------------------------------------------------------------------------------------------
[OK] Found Elvis Costello
[OK] Found relation: song
-------------------------------------------------------------------------------------------------------------------
song->Load('recordid=1') [Join Method]
-------------------------------------------------------------------------------------------------------------------
[OK] Found song
-------------------------------------------------------------------------------------------------------------------
artist->Find('artistuniqueid=1' ... ADODB_JOIN_AR) [Join Method]
-------------------------------------------------------------------------------------------------------------------
[OK] Found Elvis Costello
[OK] Found relation: song
-------------------------------------------------------------------------------------------------------------------
song->Find('recordid=1' ... ADODB_JOIN_AR) [Join Method]
-------------------------------------------------------------------------------------------------------------------
[OK] Found song
-------------------------------------------------------------------------------------------------------------------
artist->Find('artistuniqueid=1' ... ADODB_WORK_AR) [Work Method]
-------------------------------------------------------------------------------------------------------------------
[OK] Found Elvis Costello
[OK] Found relation: song
-------------------------------------------------------------------------------------------------------------------
song->Find('recordid=1' ... ADODB_JOIN_AR) [Join Method]
-------------------------------------------------------------------------------------------------------------------
[OK] Found song
-------------------------------------------------------------------------------------------------------------------
artist->Find('artistuniqueid=1' ... ADODB_LAZY_AR) [Lazy Method]
-------------------------------------------------------------------------------------------------------------------
[OK] Found Elvis Costello
[OK] No relation yet
[OK] Found relation: song
-------------------------------------------------------------------------------------------------------------------
song->Find('recordid=1' ... ADODB_LAZY_AR) [Lazy Method]
-------------------------------------------------------------------------------------------------------------------
[OK] Found song
[OK] No relation yet
[OK] Found relation: artist
-------------------------------------------------------------------------------------------------------------------
Test suite complete. Success.
-------------------------------------------------------------------------------------------------------------------