For anyone interested, here is a basic approach:

return_code = @db.synchronize do |conn|
  stmnt = conn.prepareCall('{ ? = call dbo.sp_sequel_test() }')
  stmnt.registerOutParameter(1, java::sql::Types::INTEGER)
  stmnt.execute
  # output parameters have not yet been processed, must call 
getMoreResults() first.
  stmnt.getMoreResults  
  stmnt.getInt(1)
end


On Wednesday, 3 October 2012 08:10:51 UTC+1, Stu Gray wrote:
>
> OK - thanks Jeremy.
>
> I'll look into Database#synchronize as you mention.
>
> Thanks again,
> Stu
>
>
> On Tuesday, 2 October 2012 18:20:03 UTC+1, Jeremy Evans wrote:
>>
>> On Tuesday, October 2, 2012 3:11:02 AM UTC-7, Stu Gray wrote:
>>
>>> Hi all,
>>>
>>> I asked this question on Stack Overflow yesterday, but maybe it's better 
>>> to come direct to you guys.
>>>
>>> In MS SQL Server a stored procedure can return an integer value called a 
>>> return 
>>> code<http://msdn.microsoft.com/en-us/library/ms190778%28v=sql.105%29.aspx> 
>>> to 
>>> indicate the execution status of a procedure.
>>>
>>> Does Sequel support this?
>>>
>>> The value returned from my_stored_proc.call() does not match the 
>>> integer I am returning in SQL. Is there some other way to access this?
>>>
>>> Thanks!
>>>
>>> Stu
>>>
>>>
>>> http://stackoverflow.com/questions/12674874/stored-procedure-return-codes-in-sequel-ruby-orm
>>>
>>>
>>>
>> Unfortunately, Sequel's support for stored procedures is fairly limited. 
>>  I don't believe it supports return codes or in/out variables.  It's 
>> designed similarly to the prepared statement support, where delete/update 
>> returns the number of affected rows, and select yields rows.
>>
>> If Sequel's support doesn't meet your needs, use Database#synchronize to 
>> get to the underlying database connection, and operate directly on that 
>> using the connection's API (which depends on the driver in use).
>>
>> Jeremy 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/FImW0vhzx9YJ.
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