On Monday 29 May 2006 14:06, Michael Lackhoff wrote:
[...]
> I haven't done it with RDBO (yet) but we have a very similar requirement
> (everything with raw SQL).
> First the database has to be prepared, e.g. the primary key has to change
> from 'id' to 'id' + 'rev'. In our setup we use two tables, the "head" table
> with 'id' as primary key and the "cvs" table with no defined primary key.
> We don't have an extra 'rev' column but use the 'change_date' instead. Now
> every 'update' is done as the transaction:
> copy record from head to cvs
> update change_date in cvs
> update record in head
>
> It should be possible to do something similar with RDBO. I don't think you
> can use 'clone' with two tables but there are other ways to do the copy
> (copy the fields in a loop or use some raw SQL) You can either write your
> own 'save', 'load'... in a subclass or, to avoid later problems, just add
> methods like 'cvs_save', 'cvs_load' that do the special magic.

Thank you Michael for sharing you experience! 

I was headed towards similar approach as you described - having "head" and 
"repository" tables. My main concern is how to handle foreign key references 
for the prior revisions effciently. Brute force approach is to restore the 
state up to the given date/revision I'm interested in (probably in "sandbox" 
database) and run RDBO::Manager or "->load(with => object)" against the 
"sandbox". This may not be as bad idea as it sounds if peeking in prior 
revisions happens rarely enough. 

My current idea is to have in "head" table just to rows: "id" and "rev_id". 
The "rev_id" is foreign key to the "repository" table pointing the latest 
record. Within RDBO realm these 2 tables would be represented by 2 RDBO 
objects. The problem I need to solve is to "hide" these 2 objects as one 
"super" object available to the developer. 

-- Svi


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to