sqlite.lua
sqlite.lua copied to clipboard
SQL string escaping error
when insert a text column with content like a()(regex: \w\(\)) will cause error
local has_sqlite, sqlite = pcall(require, "sqlite")
local tbl = require("sqlite.tbl")
local nodes_tbl = tbl("testaaa", {
id = true,
content = "text",
})
DB = sqlite({
uri = "<PREFIX>/test.db",
nodes = nodes_tbl,
})
nodes_tbl:insert({
id = 1,
content = "a()",
})
-- when insert a text column with content like `a()`(regex: `\w\(\)`) will cause error
https://github.com/LintaoAmons/bookmarks.nvim/issues/69
I didn't look thoroughly into the codebase, but this is a quick fix I did. (I had this error coming from bookmarks.nvim as well) https://github.com/supasorn/sqlite.lua/commit/aef7ccbb0f5c3c0d8a01c4e1afc861d37521e526