in reply to [DbIx::Class] How to execute stored procedure?

I see you haven't gotten a reply in 11 hours. I must say I know very little about DBIx::Class, and my limited experience with MSSQL is more than 5 years ago. Anyway. I do have recent experience with DBI (and DBIx::Simple) and with stored procedures in Oracle.

What works for me in DBIx::Simple, using Oracle, is a call like this:

$db->query('BEGIN sp_name(?,?); END;', $param1, $param2);
(In Oracle, to call a procedure from SQL, is to put it in an anonymous block.)

So from DBI, I just treat the call to the PL/SQL block as a straightforward SQL call, with support for placeholders for the parameters. You don't have to use DBIx::Simple; in plain DBI you could use the do method, in virtually the same way.

I think you should do the same, with MSSQL: call the syntax you have to use as a straightforward SQL call, and use placeholders.

I'm quite sure DBIx::Class has ways to directly embedding SQL calls in your modules, and that's the route to take.

Replies are listed 'Best First'.
Re^2: [DBIx::Class] How to execute stored procedure?
by dreel (Sexton) on May 27, 2007 at 12:06 UTC
    DBIx::Class it's an ORM. It can make classes with data retrieved from DB, and in App I can use abstract of result set. The problem is how to compose SP call and retrieve data into class.