-
Notifications
You must be signed in to change notification settings - Fork 236
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
The return value of query #48
Comments
@ZouDikai An empty result set is a totally valid result set and no error should get returned. I think you misunderstand the outcome of your SQL query. |
How do I know whether the result set is empty? |
@wowxunyl You'll get an empty table for that. |
The result of sql below is empty in mysql client, but the lua table res deed has key(new_visitor, return_visitor) whose value I print using ngx.log is NULL. I really can't figure out why this happens.
|
@wowxunyl Maybe you mysql client is trying to do something clever. Not sure. This library just outputs whatever from the mysqld server responses. |
When i tried the query method as the readme said:
res,err,errcode,sqlstate=db:query("select * from account where id="..id..";")
The correct query was OK.And to test the condition of bad result("empty set"),i use an id that does not exits in the MySQL table.However,unexpectedly,the if statement following the query:
if not res then
never excuted,which means res is not nil......And i tried
if not res[1] then
,it works as i expected(Though err errcode sqlstate were all nil )I want to know what's wrong with it :)
The text was updated successfully, but these errors were encountered: