[CDBI] Record versioning

Wake me in a thousand years nazareth at eye-of-newt.com
Wed Mar 15 07:18:24 GMT 2006


>Hello,
>I'm wondering, does some record versioning scheme exist in the 
>Class::DBI world?
>I mean, say I augment my key with a version tag and override 
>update() with some timestamping+insert()... How would its API be 
>like? { firstversion(), lastversion(), nextversion(), 
>firstversionafter(date), lastversionbefore(date)...}? Isn't this 
>sort of thing likely to be useful to wiki-like applications?
>If there isn't such a thing, which would be a sane approach to 
>implementing it?

I just did a short write up on the Wiki for a scheme that I wrote a 
while back for (you guessed it) a Wiki. It doesn't do anything 
sophisticated with the API. If you want a version, you can search for 
it by number (since I use numbers serially, firstversion is 1, 
$n->lastversion is n-1, and $n->nextversion is n+1) or do a date 
query based on the modified field.

http://wiki.class-dbi.com/wiki/Versioning_with_two_tables

The use of rules and locking may rule it out as "sane", though.


-- 
Aneel Nazareth -- http://eye-of-newt.com/nazareth --




More information about the ClassDBI mailing list