[Fwd: Re: [CDBI] 2 Questions?]

melo_am0 at sewanee.edu melo_am0 at sewanee.edu
Thu Sep 15 20:34:40 BST 2005


> If your DBD's thread safe, CDBI should be thread safe. The DBD probably
> isn't though ...
>

>> Secondly, is there a safe way to have a constructor that's called each
>> time CDBI instantiates an object? I have a trigger set on before_create
>> and select, but sometimes a class's constructor is never called, and
>> other times the constructor is called twice.
>
> Overriding 'construct' may do the trick for you.

No dice, the construct isn't called during my::class->create calls. Same
with new...perhaps there's something blindingly obvious I'm missing, but
it seems like providing user-supplied constructors would be a fairly
simple proposition.


> DBIx::Class gets round this by having a real 'new' method, which makes
> life rather simpler (and also allows objects not in the db - create is
> just a shortcut for ->new(...)->insert)

Sounds interesting. Would a transition to DBIx::Class be particuarly
difficult?

Thanks for your help-

Andrew





More information about the ClassDBI mailing list