On Mar 21, 2007, at 7:43 AM, Mario Minati wrote:
Am Mittwoch 21 März 2007 11:39 schrieb Stephan Austermühle:
The database tables are being loaded dynamically by
Catalyst::Model::DBIC::Schema/ DBIx::Class::Schema::Loader. I read
that I
can get the DBH via $schema->storage->dbh -- but where do I get
$schema
from?
my $dbh = $c->model( 'MyModel' )->schema->storage->dbh;
Just be sure you don't hold onto the handle for too long, or strange
things can happen (especially in a persistent environment).
In the table class I can create custom functions to alter or get the
resultsets.
How complex can a query be that you want the DBI handle?
With DBIC you can do almost everything, e.g. multi table joins,
creating
aliases with user defined functions and procedures.
At least for me that's all I want :)
There is at least one thing that I've used this for that DBIx::Class
can't do (or at least I couldn't figure out how at the time I needed
to do it)...
$c->model( 'MyModel' )->schema->storage->dbh->do( "NOTIFY
update_listener" );
--
Jason Kohles
[EMAIL PROTECTED]
http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire
_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/