sqlite.lua icon indicating copy to clipboard operation
sqlite.lua copied to clipboard

SQL string escaping error

Open LintaoAmons opened this issue 9 months ago • 1 comments

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

LintaoAmons avatar Feb 15 '25 01:02 LintaoAmons

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

supasorn avatar Mar 14 '25 07:03 supasorn