Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching result of stored procedure returns single record #47

Open
Paul-Wasilewski opened this issue May 23, 2016 · 4 comments
Open

Fetching result of stored procedure returns single record #47

Paul-Wasilewski opened this issue May 23, 2016 · 4 comments

Comments

@Paul-Wasilewski
Copy link

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?

@tomasguisasola
Copy link
Contributor

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:

[1] #47

@Paul-Wasilewski
Copy link
Author

Hi Tomás,

thanks for the quick response. I am using the MySQL driver https://github.com/LuaDist/luasql-mysql.

Regards,
Paul

@Paul-Wasilewski
Copy link
Author

Hi Tomás

Unfortunately, I can't figuring out if the MySQL driver supports stored procedures. Can you help?

BR,
Paul

@tomasguisasola
Copy link
Contributor

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]
#47 (comment)
[2]
https://github.com/notifications/unsubscribe/AAIA7SPq8p2hO0tpn3WVd30iThodfXpnks5qItufgaJpZM4IkLG2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants