On 29 May 2006 at 13:21, Svilen Ivanov wrote:

> I would like to extend RDBO to support versioning of properties for each 
> instance. To explain it better I will use analogy with CVS: 
>       * calling "->save" will make new revision of the object ("cvs commit")
>       * "->load(id=>1)" will get by default the latest version ("cvs 
> checkout")
>       * "->load(id=>1, rev => 5)" will get the fifth revison of this 
> particular 
> instance ("cvs -r 1.5 checkout")
> The ultimate goal is to have ability to rollback the objects to their state 
> at 
> a specific point of time in the past. It would be the best if I can do it as 
> layer on top of existing RDBO.
> 
> Do you guys have any ideas or experience with such sort of tasks so you could 
> give me some directions? 

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.

Cheers,
Michael



-------------------------------------------------------
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