[Dbix-class] Class::DBI vs DBIx and CDBICompat

Steven Mackenzie dbix at aptile.co.uk
Fri Jun 23 15:02:48 CEST 2006


Hello,

I stumbled upon this piece of documentation:
http://search.cpan.org/~jrobinson/DBIx-Class-0.06003/lib/DBIx/Class/CDBICompat.pm

Which suggests that I can start using DBIx::Class simply my making this
change to my Class::DBI code:

# In DBBase.pm
#use base qw( Class::DBI ); # currently using 3.0.6 from ActiveState ppm.
use base qw/DBIx::Class/; # currently 0.6000 from ActiveState pmm
__PACKAGE__->load_components( qw/CDBICompat Core DB/ );

This seemed worth a try, to see if my app might start making fewer calls
to the DB perhaps :-)

However, I get this error at startup:
Can't locate object method "set_db" via package "DBBase" at
C:\xyz\InitDatabase.pm line 33.

In my application I make the call to the Class::DBI method set_db via my
DBBase.pm module, like this:
  DBBase->set_db
  (
    'Main',
    $dsn, # passed in by caller
    $username,
    $password,
    {RaiseError => 1,
     AutoCommit => 0, # Don't autocommit transactions
     unicode => 1}
  );

It seems that this isn't part of the emulated funcionality, and so I
have two questions:

How can I set the DBIx::Class DB connection?

Is there any possible reduction in DB traffic to be gained by using
DBIxC over CDBI?

Thanks in advance for any tips or pointers,
Steven







More information about the Dbix-class mailing list