[Dbix-class] [newbie]How to call stored procedure?(doc already
read)
Tony Winslow
tonywinslow1986 at gmail.com
Fri Dec 28 15:23:44 GMT 2007
Jason Kohles wrote:
> On Dec 28, 2007, at 9:42 AM, Jason Kohles wrote:
>
>> 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:
>>
> Also from DBIx::Class::Manual::Cookbook:
>
> Using database functions or stored procedures
>
> The combination of "select" and "as" can be used to return the
> result
> of a database function or stored procedure as a column value.
> You use
> "select" to specify the source for your column value (e.g. a
> column
> name, function, or stored procedure name).
>
I'm confused of it. The whole paragraph!
eg: I've a procedure called proc1 which has one output parameter.
So in the MySQL client env. I have to call it sth. like:
CALL proc1(@a);
SELECT @a;
And in programs, I think it is sth. more like this:
execute('CALL proc1(?)');
my $result = get_column(1);
The problem now is I don't know how to do it under the DBIx-Class env.
My Env: Catalyst/TT, DBIx-Class/MySQL
More information about the DBIx-Class
mailing list