Jeremy,

many thanks for your advice. Things seem to work okay by overriding
_insert method.

Noticed one interesting side-effect, though: if the query is correct,
everything goes well. When the query fails, however, Sequel calls the
database six times: three times trying to select * from [failed query]
and two more times re-running the failed query. Could not figure out
what was causing that, or how to go about preventing it.

Here's the code and the output:

http://pastie.org/1738735

Best,
j.

On Mar 30, 7:28 pm, Jeremy Evans <[email protected]> wrote:
> On Mar 30, 10:16 am, Johnathan <[email protected]> wrote:
>
> > Hi,
>
> > was wondering if it's possible somehow to override the
> > Sequel::Model.create method in a class to use stored procedure calls
> > for inserting/updating? (I'm using SQL Server via ADO).
>
> The ADO adapter doesn't support stored procedures directly, though you
> may be able to drop down to SQL to use them.
>
> > For example, to insert into a user table, I'd like to call exec
> > sp_InsertUser @name, @email as the SP itself does some other stuff
> > behind the scenes.
>
> > Looking at the source, it seems that it calls into Dataset._save
> > method, which doesn't seem to provide for such option.
>
> > How would one go about doing that?
>
> Overriding Model#_insert for the model should work.  Take a look at
> the source, and if you can't get it to work, please pastie your code
> with questions and I'll take a look.
>
> Thanks,
> Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to