Open
Description
I've come across a bug when running the following code:
local tbl = require("sqlite.tbl") --- for constructing sql tables
local db = require("sqlite.db") --- for constructing sql databases
-- the data table
local tbl_data = tbl("data", {
id = true,
test = { "text", required = true, unique = true },
})
local tbls = {
uri = "~/test.sqlite3",
data = tbl_data,
}
local data = db(tbls)
data.data:remove() -- to ensure tbl is empty
data.data:insert({ test = "tes(t)" })
Gives:
E5113: Error while calling lua chunk: ...im/site/pack/packer/start/sqlite.lua/lua/sqlite/stmt.lua:35
: sqlite.lua: sql statement parse, , stmt: `insert into data (test) values(tes(t))`, err: `(`no such
column: t`)`
It only happens when
- both opening and closing brackets are in the string
- the closing bracket is the last char of the string
I'm guessing something isn't being escaped properly.