I'm trying to create a simple table, just with names, but when I enter a value, you can not enter any more. How I am 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