sqlite.lua
sqlite.lua copied to clipboard
unrecognized token: "$" on db:select
- create file
/tmp/test.db
local _, sqlite = pcall(require, 'sqlite.db')
local context = [[
The command is always executed with 'magic' not set. The only special
characters in a search pattern are "^" (begin-of-line) and "$" (<EOL>).
See |pattern|. Note that you must put a backslash before each backslash in
the search text. This is for backwards compatibility with Vi.
]]
local db = sqlite.new('/tmp/test.db'):open()
local ok = db:create("sentence", {
id = { type = "integer", required = true, primary = true },
context = { type = "text", required = true },
ensure = true,
})
local ok, data_id = db:insert('sentence', {
context = context,
})
if ok then
local sentence_table = db:select('sentence', {
where = {
context = context,
}
})
end
- execute
luafile /tmp/test.db
- i get error
E5113: Error while calling lua chunk: ...ig/nvim/pack/packer/start/sqlite.lua/lua/sqlite/stmt.lua
:35: sqlite.lua: sql statement parse, , stmt: `select * from sentence where context = "The comman
d is always executed with 'magic' not set. The only special
characters in a search pattern are "" (begin-of-line) and "$" (<EOL>).
See |pattern|. Note that you must put a backslash before each backslash in
the search text. This is for backwards compatibility with Vi.
"`, err: `(`unrecognized token: "$"`)`
stack traceback:
[C]: in function 'assert'
...ig/nvim/pack/packer/start/sqlite.lua/lua/sqlite/stmt.lua:35: in function 'parse'
...nfig/nvim/pack/packer/start/sqlite.lua/lua/sqlite/db.lua:604: in function 'fn'
...ig/nvim/pack/packer/start/sqlite.lua/lua/sqlite/defs.lua:663: in function 'select'
/tmp/t.lua:21: in main chunk