Open Paul-Wasilewski opened 8 years ago
Hi Paul
LuaSQL does not guarantee support for stored procedures, but it could be available in one driver or another. What driver are you using?
Regards, Tomás
On 2016-05-23 01:04, PaulWasilewski wrote:
When I try to fetch the result of a stored procedure it returns only one record.
res, err, errno, sqlstate = db:query("call icenter.queryUserOTHistorySessionRB(4780,'2016-03-01 00:00:00','2016-04-30 23:59:59');");
That's the result:
[{"LogoffTime":"2016-04-14 07:30:00","user_id":4780,"resource_id":1335,"ResourceName":"WTH5401171","InuseTime":54000,"IdleTime":0,"LogonTime":"2016-04-13 16:30:00"}]
Is it true that LuaSQL doesn't support fetching results from stored procedures?
You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub [1]
*
Links:
Hi Tomás,
thanks for the quick response. I am using the MySQL driver https://github.com/LuaDist/luasql-mysql.
Regards, Paul
Hi Tomás
Unfortunately, I can't figuring out if the MySQL driver supports stored procedures. Can you help?
BR, Paul
Hi Paul
It seems that the driver for MySQL don't support multiple results. According to these pages:
https://dev.mysql.com/doc/refman/5.7/en/c-api-multiple-queries.html https://dev.mysql.com/doc/refman/5.7/en/mysql-real-connect.html
The connection to the database should be opened with a flag indicating that multiple results can occur, but the actual connction does not pass any flag (luasql/src/ls_mysql.c; lines 503 and 504):
if (!mysql_real_connect(conn, host, username, password,
sourcename, port, NULL, 0))
Thus, I think you cannot retrieve multiple results. Besides, it seems that the way to retrieve the other results would need additional treatment, which does not seem trivial to me. So I wouldn't recommend any change without knowing what should be done.
Regards, Tomás
On 2016-06-05 11:22, PaulWasilewski wrote:
Hi Tomás
Unfortunately, I can't figuring out if the MySQL driver supports stored procedures. Can you help?
BR, Paul
You are receiving this because you commented. Reply to this email directly, view it on GitHub [1], or mute the thread [2].
*
Links:
[1] https://github.com/keplerproject/luasql/issues/47#issuecomment-223815823 [2] https://github.com/notifications/unsubscribe/AAIA7SPq8p2hO0tpn3WVd30iThodfXpnks5qItufgaJpZM4IkLG2
When I try to fetch the result of a stored procedure it returns only one record.
res, err, errno, sqlstate = db:query("call icenter.queryUserOTHistorySessionRB(4780,'2016-03-01 00:00:00','2016-04-30 23:59:59');");
That's the result:
[{"LogoffTime":"2016-04-14 07:30:00","user_id":4780,"resource_id":1335,"ResourceName":"WTH5401171","InuseTime":54000,"IdleTime":0,"LogonTime":"2016-04-13 16:30:00"}]
Is it true that LuaSQL doesn't support fetching results from stored procedures?