[CDBI] using different DSNs for reads/writes

Brian Duggan bduggan at matatu.org
Thu Dec 20 19:02:04 GMT 2007


On Thursday, December 20, Bill Moseley wrote: 
> On Wed, Dec 19, 2007 at 08:50:31PM -0500, Brian Duggan wrote:
> > 
> > sub db_Main {
> >     my $class  = shift;
> >     return $class->useWriteDBH ? $class->db_Write(@_) : $class->db_Read(@_);
> > }
> 
> I wonder if would be possible to determine read or write by looking up
> the call stack.

Sounds possible...alternatively, CDBI triggers could set the useWriteDBH flag.  
(i.e. a select trigger would set it to 0, insert/update/delete triggers would
set it to 1)

Brian




More information about the ClassDBI mailing list