Correction, you want to add it to the ResultSet class, not the result class!
and yes there's a way.

http://search.cpan.org/~blblack/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod#Predefined_searches

http://search.cpan.org/~jrobinson/DBIx-Class-0.07999_02/lib/DBIx/Class/Storage/DBI.pm

$self->result_source->schema->storage

On 5/18/07, John Goulah <[EMAIL PROTECTED]> wrote:

On 5/18/07, Ronald J Kimball <[EMAIL PROTECTED]> wrote:
>
> John Goulah wrote:
> > This leads to the question of whether you can write straight SQL in
> > times like these.  I suppose it breaks the design, but sometimes its
> > just easier to write SQL... Is it possible?
>
> Yes, you can.  That's actually what I have in my code right now.  Like
> so:
>
> my $dbh = $schema->storage->dbh;
>
> my $sth = $dbh->prepare(<<"EndOfSQL");
>    ...
> EndOfSQL
>
> $sth->execute();




So, that does seem to work, and I can even put a method in the
Model/myDB.pm file and call that via $c->model.   But what I'd rather do is
add these methods into the table model classes under lib/myDB/*.pm.   Is
there a way to access the storage->dbh handle from there?


Thanks,
John





_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive:
http://www.mail-archive.com/[email protected]/

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to