Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

tmtm (2563)

tmtm
  (email not shown publicly)
http://www.tmtm.com/nothing/

Journal of tmtm (2563)

Thursday December 27, 2001
05:19 PM

So far but not quite near enough.

[ #1803 ]

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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • One of Alzabo's users suggested hooks exactly like you describe a while back, including pre and post select hooks. Maybe we can make a better effort to talk about neat stuff we're doing in our libraries and try to share it. Alzabo has quite a number of funky tricks that Class::DBI could probably borrow, and likely vice versa.
    • 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...