You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
local_, sqlite=pcall(require, 'sqlite.db')
localcontext=[[The command is always executed with 'magic' not set. The only specialcharacters in a search pattern are "^" (begin-of-line) and "$" (<EOL>).See |pattern|. Note that you must put a backslash before each backslash inthe search text. This is for backwards compatibility with Vi.]]localdb=sqlite.new('/tmp/test.db'):open()
localok=db:create("sentence", {
id= { type="integer", required=true, primary=true },
context= { type="text", required=true },
ensure=true,
})
localok, data_id=db:insert('sentence', {
context=context,
})
ifokthenlocalsentence_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
The text was updated successfully, but these errors were encountered:
yyy33
changed the title
error when select
[bug]error when select
Jan 13, 2023
In this case I tried @steliyan escape and unescape function:
localescape=function(content)
returnstring.format("__ESCAPED__'%s'", content)
endlocalunescape=function(content)
returncontent:gsub("^__ESCAPED__'(.*)'$", "%1")
end
The insert works without escaping, however the where function fails with escaping insert and selected.
The error result from libsqlite itself. hmmm seems something you have to adhere to in sqlite itself. However it would be nice if this can be supported here.
/tmp/test.db
luafile /tmp/test.db
The text was updated successfully, but these errors were encountered: