Skip to content

Commit 85936d6

Browse files
authored
fix(engine/sqlite): support for repeated table_option (#2482)
* fix(engine/sqlite): support for repeated table_option fix #2481 ref: https://www.sqlite.org/syntax/create-table-stmt.html ref: https://www.sqlite.org/syntax/table-options.html * test: add endtoend
1 parent 6a0c227 commit 85936d6

File tree

10 files changed

+3003
-2693
lines changed

10 files changed

+3003
-2693
lines changed

internal/endtoend/testdata/sqlite_table_options/sqlite/go/db.go

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CREATE TABLE authors1 (
2+
id INTEGER PRIMARY KEY,
3+
name text NOT NULL,
4+
bio text
5+
) STRICT, WITHOUT ROWID;
6+
7+
CREATE TABLE authors2 (
8+
id INTEGER PRIMARY KEY,
9+
name text NOT NULL,
10+
bio text
11+
) WITHOUT ROWID, STRICT;
12+
13+
CREATE TABLE authors3 (
14+
id INTEGER PRIMARY KEY,
15+
name text NOT NULL,
16+
bio text
17+
) WITHOUT ROWID;
18+
19+
CREATE TABLE authors4 (
20+
id INTEGER PRIMARY KEY,
21+
name text NOT NULL,
22+
bio text
23+
) STRICT;
24+
25+
-- name: GetAuthor :one
26+
SELECT * FROM authors1
27+
WHERE id = ?1 LIMIT 1;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": "1",
3+
"packages": [
4+
{
5+
"path": "go",
6+
"engine": "sqlite",
7+
"schema": "query.sql",
8+
"queries": "query.sql",
9+
"name": "querytest"
10+
}
11+
]
12+
}

internal/engine/sqlite/parser/SQLiteParser.g4

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,17 @@ create_index_stmt:
117117
indexed_column: (column_name | expr) (COLLATE_ collation_name)? asc_desc?
118118
;
119119

120+
table_option:
121+
WITHOUT_ row_ROW_ID = IDENTIFIER
122+
| STRICT_
123+
;
124+
120125
create_table_stmt:
121126
CREATE_ (TEMP_ | TEMPORARY_)? TABLE_ (IF_ NOT_ EXISTS_)? (
122127
schema_name DOT
123128
)? table_name (
124129
OPEN_PAR column_def (COMMA column_def)*? (COMMA table_constraint)* CLOSE_PAR (
125-
(WITHOUT_ row_ROW_ID = IDENTIFIER) | (STRICT_)
130+
table_option (COMMA table_option)*
126131
)?
127132
| AS_ select_stmt
128133
)

internal/engine/sqlite/parser/SQLiteParser.interp

Lines changed: 2 additions & 1 deletion
Large diffs are not rendered by default.

internal/engine/sqlite/parser/sqlite_parser.go

Lines changed: 2858 additions & 2691 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/engine/sqlite/parser/sqliteparser_base_listener.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/engine/sqlite/parser/sqliteparser_listener.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)