On Sun, Feb 12, 2012 at 02:16:07PM +0700, Henrik Sarvell wrote:
> "Also As master records don;t relate to each other I'm a little
> confused as to how I hand the rest of the database together.
> Do I just start it and add objects to it Or do I need to build a top
> level List of master objects and set this as the first object
> in the database."
>
> No you just go ahead and create objects:
>
> (new (db: +Article) '(+Article) 'htmlUrl HtmlUrl)
Right.
In case of
(class +Child +Entity)
(rel description (+Key +String))
(rel rank (+Number))
(class +Master +Entity)
(rel children (+List +Link) (+Child))
you could do (with full 'dbSync' and 'commit' in a multiuser context):
(dbSync)
(new (db: +Master) '(+Master)
'children
(list
(new (db: +Child) '(+Child) 'description "desc1" 'rank 1)
(new (db: +Child) '(+Child) 'description "desc2" 'rank 2)
(new (db: +Child) '(+Child) 'description "desc3" 'rank 3) ) )
(commit 'upd)
or
(dbSync)
(let M (new (db: +Master) '(+Master))
(while (moreChildren)
(put> M 'children
(new (db: +Child) '(+Child)
'description (getDesc)
'rank (getRank) ) ) ) )
(commit 'upd)
(not tested :)
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe