in reply to Re: SQL function from DBIC
in thread SQL function from DBIC
If you are going to dig in and do something with a database handle directly, the recommended way is:
use Data::Dumper; $schema->storage->dbh_do( sub { my ( $storage, $dbh ) = @_; print Dumper $dbh->selectall_arrayref( 'select enum_range(typename);', { slice => {} } ); } );
The dbh_do method (documented in DBIx::Class::Storage::DBI) gives you the benefit of things like automatic reconnection to the database if your connection has timed out or the server has been restarted.
Also, db_Main is from Class::DBI, not DBIx::Class, although there is a CDBICompat component that will make the latter work mostly like the former (though in the long run you will be better off by just learning the DBIx::Class way, rather than using CDBICompat).
|
---|
In Section
Seekers of Perl Wisdom