escape_sqlite_table_name => escape_sqlite, handles reserved words

It can be used for column names as well as table names.

Reserved word list from https://www.sqlite.org/lang_keywords.html
This commit is contained in:
Simon Willison 2018-04-03 06:39:50 -07:00
commit 8f0d44d646
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
7 changed files with 68 additions and 25 deletions

View file

@ -116,6 +116,13 @@ CREATE TABLE "complex_foreign_keys" (
FOREIGN KEY ("f3") REFERENCES [simple_primary_key](id)
);
CREATE TABLE [select] (
[group] text,
[having] text,
[and] text
);
INSERT INTO [select] VALUES ('group', 'having', 'and');
INSERT INTO simple_primary_key VALUES (1, 'hello');
INSERT INTO simple_primary_key VALUES (2, 'world');
INSERT INTO simple_primary_key VALUES (3, '');