Skip to content

unrecognized token: "$" on db:select #158

Description

@yyy33
  1. 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
  1. execute luafile /tmp/test.db
  2. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions