lunarmodules / luasql

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

fetch returns a sting instead of a table. #130

Closed laigor closed 5 months ago

laigor commented 2 years ago

fetch return all row data as sting.

local driver = require "luasql.odbc"
local odbc_env = driver.odbc()
local odbc_conn = odbc_env:connect("...","...","...")
local odbc_cur = odbc_conn:execute('select .....')
print(type(odbc_cur:fetch()))

return:

string
tomasguisasola commented 2 years ago

Hi

Check the docs ( https://keplerproject.github.io/luasql/manual.html#cursor_object):

"If fetch is called without parameters, the results will be returned directly to the caller. If fetch is called with a table, the results will be copied into the table and the changed table will be returned."

The examples (https://keplerproject.github.io/luasql/examples.html) show how to retrieve results in a table.

Regards, Tomás

Em ter., 28 de set. de 2021 às 07:40, laigor @.***> escreveu:

fetch return all row data as sting.

local driver = require "luasql.odbc" local odbc_env = driver.odbc() local odbc_conn = odbc_env:connect("...","...","...") local odbc_cur = odbc_conn:execute('select .....') print(type(odbc_cur:fetch()))

return:

string

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/keplerproject/luasql/issues/130, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAB3L52YQQKL6HHOZRRGTUEGLTRANCNFSM5E5C5FQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.