lunarmodules / luasql

LuaSQL is a simple interface from Lua to a DBMS.
http://lunarmodules.github.io/luasql
545 stars 191 forks source link

Executing stored procedures in Firebird driver works #97

Closed nightwizard0 closed 5 years ago

nightwizard0 commented 6 years ago

Statements like that: execute procedure Foo(5); didn't work for the Firebird driver.

According to the documentation they have statement code 8. In current version of driver this code is prohibited. But if procedure has returning values it will work: select * from Foo(5); because it is a "select" statement. It so strange, and I have decided to path that.

blumf commented 6 years ago

Funnily enough, I had recently added this to my own branch.

It's a bit more involved than just adding the statement type. The cursor needs to handle any results the procedure may return, which doesn't work exactly the same as the usual SELECT cursors (single row returned, but doesn't neatly close on it's own)

This mean, not only can you directly call procs and get their results (still need the SELECT * FROM Proc style call for 'selectable' procedures, i.e. ones that use SUSPEND), but also use the INSERT INTO ... RETURNING AUTO_KEY_COL style statements.

Take a look at pull req. #98 does that work for you?

nightwizard0 commented 5 years ago

Sorry for late answer. Yes, #98 works for me, thank you