[Dbix-class] [newbie]How to call stored procedure?(doc already read)

Jason Kohles email at jasonkohles.com
Fri Dec 28 14:42:49 GMT 2007


On Dec 28, 2007, at 3:59 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?
>

 From DBIx::Class::Manual::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 DBIx-Class mailing list