Re: [CDBI] 2 Questions?

[prev] [thread] [next] [Date index for 2005/09/15]

From: Matt S Trout
Subject: Re: [CDBI] 2 Questions?
Date: 17:05 on 15 Sep 2005
On Thu, Sep 15, 2005 at 10:51:46AM -0500, melo_am0@xxxxxxx.xxx wrote:
> Hey guys-
> 
> Two quick things. Firstly, is CDBI thread-safe or do I need to wrap locks
> around functions that call CDBI methods to prevent bad things (tm) from
> happening?

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.

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)

        -- 
             Matt S Trout       Specialists in perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] 2 Questions?
melo_am0 15:51 on 15 Sep 2005

Re: [CDBI] 2 Questions?
Matt S Trout 17:05 on 15 Sep 2005

Generated at 09:55 on 16 Sep 2005 by mariachi v0.52