Spent most of today hacking on Class::DBI.
Tatsuhiko Miyagawa has pulled out the 'trigger' code that I wrote to allow Class::DBI::mysql::FullTextSearch to happen, so I was able to pull that all back out again and replace it with the single line:
use Class::Trigger
Then I came up with a way to add a pre-insert trigger, which meant I was able to add the first version of constraints, and will now provide a much better way of allowing default values that can't be specified at the database (e.g. MySQL doesn't allow CURDATE() as a default, and you currently have to do much madness to implement this in Class::DBI).
I also had one of those "blinding flash of the obvious" moments on Christmas Eve, when I realised that, although it's quite unorthodox in database terms, Class::DBI really needs an ON SELECT trigger. So I added that, and now it makes it ludicrously simple to add code to, for example, convert all 'DATE' fields to Date::Simple objects as they get retrieved from the database.
I just need to finish off the new Cookbook, and I can release this version.
But before I could do that I got much too waylaid by a nasty memory leak, somewhere within the Class::DBI -> Ima::DBI -> DBI chain. My process to rebuild the Music Database kept getting bigger and bigger and bigger. It took about 2 hours to even find out where it was happening, and I still haven't worked out why.
There's some sort of nasty collision somewhere in the cached $sth code, but trying to get my head around all those closures, inheritable class-data lookups, and barely documented features of DBI just proved too much for today.
And tomorrow I really need to finish off some client work ...
Re:Need to talk more on the POOP list
lachoy on 2001-12-28T04:16:48
In my mind, this is one of the nifty things about SPOPS -- there are pre/post fetch/save/remove handlers (called 'rules') for which you can create as many actions as you wish. There are some tricky areas -- rules are unordered (since they don't know about each other), so what happens if one rule modifies the data of an object before another rule gets to it? Fun...