1
I’m trying to create a simple table, just with names, but when I enter a value, I can’t enter any more. Like I’m doing:
require 'luasql.sqlite3'
local env = luasql.sqlite3()
local con = env:connect('database.s3db')
con:execute([[
CREATE TABLE IF NOT EXISTS users(
name varchar(50)
)
]])
con:execute([[
INSERT INTO users VALUES('Alguem');
INSERT INTO users VALUES('Outro');
INSERT INTO users VALUES('Mais Outro');
]])
cur = assert(con:execute([[
SELECT * FROM users
]]))
local result = {}
cur:fetch(result, 'a')
for i,v in pairs(result) do
print(i,v)
end
cur:close()
con:close()
env:close()
os.execute('pause')
In this case, print only:
name Alguem
When should I print:
name Alguem
name Outro
name Mais Outro
I never used Luasql but it seems to be all right except for the
assert
, He’s supposed to be right there?– Maniero
Yes, and even if you remove it, it still doesn’t work as desired.
– Gabriel Sales