Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to quote SQLite identifiers #18

Open
shofetim opened this issue Jun 23, 2023 · 0 comments
Open

How to quote SQLite identifiers #18

shofetim opened this issue Jun 23, 2023 · 0 comments

Comments

@shofetim
Copy link

shofetim commented Jun 23, 2023

Test case:

Running this:

(import sqlite3 :as sql)
(def db (sql/open "test.db"))
(sql/eval db `CREATE TABLE customers (id INTEGER PRIMARY KEY, "first-name" TEXT);`)
(sql/eval db `INSERT INTO customers (id, "first-name") VALUES(:id, :first-name);`
          {:first-name "John" :id 12345})

Results in:

error: no such column: name
  in sqlite3/eval
  in _thunk [test.janet] (tailcall) on line 4, column 1

It should be possible to quote SQLite identifiers with any of "" `` [] for reference see: https://www.sqlite.org/lang_keywords.html

None of which appear to work.

Opening the same DB in the SQLite command line client and executing
INSERT INTO customers (id, "first-name") VALUES(12345, 'John');

Works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant