[Catalyst] [newbie]How to call stored procedure?
Jason Kohles
email at jasonkohles.com
Fri Dec 28 14:41:49 GMT 2007
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 at jasonkohles.com - http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire
More information about the Catalyst
mailing list