On Dec 28, 2007, at 8:19 AM, Tony Winslow wrote:
Hi, all!
I've stored procedures defined in my database schema, and I need to
call them in my code.
The arbitrary-sql approach won't help since it writes sql statements
in source code to act as stored procedures. So could I do that in
DBIx?
You were probably looking in the Catalyst docs rather than the
DBIx::Class (I'm assuming because you asked the Catalyst mailing list,
rather than the DBIx::Class mailing list, which would have been more
appropriate. Had you checked the DBIx::Class documentation, you
probably would have found this in the cookbook...
Arbitrary SQL through a custom ResultSource
Sometimes you have to run arbitrary SQL because your query is
too
complex (e.g. it contains Unions, Sub-Selects, Stored
Procedures, etc.)
or has to be optimized for your database in a special way, but
you
still want to get the results as a DBIx::Class::ResultSet. The
recommended way to accomplish this is by defining a separate
ResultSource for your query. You can then inject complete SQL
statements using a scalar reference (this is a feature of
SQL::Abstract).
--
Jason Kohles, RHCA RHCDS RHCE
[EMAIL PROTECTED] - http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/