FredP
May 15th, 2010, 03:59 AM
Hi,
I would like to construct my query using concatenation, but I've got this error in the console : attempt to concatenate a nil value
require 'luasqlsqlite3';
local env = luasql.sqlite3();
local con = assert( env:connect("sqlite_db"))
local valeur = "THEO"
cur = assert (con:execute"SELECT * from CONSIGNE WHERE PIECE = '"..valeur.."'")
row = cur:fetch ({}, "a")
while row do
print(row.PIECE, row.TEMP, row.ZN)
-- reusing the table of results
row = cur:fetch (row, "a")
end
-- close everything
cur:close()
con:close()
env:close()
No problems using a simple query :
cur = assert (con:execute"SELECT * from CONSIGNE WHERE PIECE = 'THEO'")
What is the best way to construct a concatenated query ?
Thanks in advance
Fred
I would like to construct my query using concatenation, but I've got this error in the console : attempt to concatenate a nil value
require 'luasqlsqlite3';
local env = luasql.sqlite3();
local con = assert( env:connect("sqlite_db"))
local valeur = "THEO"
cur = assert (con:execute"SELECT * from CONSIGNE WHERE PIECE = '"..valeur.."'")
row = cur:fetch ({}, "a")
while row do
print(row.PIECE, row.TEMP, row.ZN)
-- reusing the table of results
row = cur:fetch (row, "a")
end
-- close everything
cur:close()
con:close()
env:close()
No problems using a simple query :
cur = assert (con:execute"SELECT * from CONSIGNE WHERE PIECE = 'THEO'")
What is the best way to construct a concatenated query ?
Thanks in advance
Fred