Hello!

I need to call a MySQL stored procedure that uses an INOUT parameter as 
documented in

  https://dev.mysql.com/doc/refman/8.0/en/call.html

Is this supported in Sequel?

The actual stored procedure I need to call is something like

CREATE PROCEDURE upsert_person (
  INOUT p_person_id int(11) unsigned,
  p_org_id int(10) unsigned,
  ...
  )
BEGIN
  ...
END;

I tried something like the following, but it didn't work:

persons = DB[:person]
sp_params = {
  person_id: nil,
  ...
}
persons.call_sproc(:insert, :upsert_person, *sp_params.values)

I also tried just using the DB instance directly, but that didn't work 
either:

DB.call_sproc(:upsert_person, args: sp_params.values)

The exception I get is:

~/.gem/ruby/gems/mysql2-0.5.3/lib/mysql2/client.rb:131:in `_query': 
Mysql2::Error: OUT or INOUT argument 1 for routine mydb.upsert_person is 
not a variable or NEW pseudo-variable in BEFORE trigger 
(Sequel::DatabaseError)
The only documentation I could find on stored procedures was in the 2.8.0 
release notes

  https://sequel.jeremyevans.net/rdoc/files/doc/release_notes/2_8_0_txt.html

and that doesn't mention OUT or INOUT parameters.

How can I make this work?  Or maybe it's not supported, and the best I 
could do would be to use DB.run?

Thank you!

Lewis

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/17e12e93-35f0-4344-b219-c518a715c6a6n%40googlegroups.com.

Reply via email to