Remove the stub for parsing CREATE TABLE ... AS SELECT statements. This
provides no extra value because we never come across these statements in
our context and this is not remotely implemented in a useful way.
Also remove the statement and statement list structures as they are not
used either.
This silences a couple of compiler warnings. The changes in the grammar
parser serve the same purpose: they silence at least some of the
warnings Antlr prints while generating the parser code.
In the Edit Dialog a missing break is added to a switch statement. This
seems like it actually was an unintended fallthrough for once, setting
the focus to the hex editor instead of the RTL editor.
Fix the parsing of complex, recursive expressions as they can be
especially used in CHECK constraints. This also improves the handling of
row value expressions which were somewhat in conflict with recursive
expressions. So with this commit we should be back to a more stable
expression parser in general.
See issue #1969.
SQLite allows some keywords to be used for table names and some other
keywords to be used for column names without using any quotes. Our
grammar parser needs to know which keywords are allowed and which are
not. In the two lists (one for table names and one for column names)
there were a few errors and omissions. This commit should fix them.
This was pointed out in #1716.
Remove the window function grammar rules. I think they are not needed
anyway as long as we only parse CREATE TABLE and CREATE INDEX
statements and unexpectedly they do seem to cause problems. It it still
worth investigating how this is possible but for now removing them seems
like the best option.
See issue #1733.
We don't do anything with the extended parser yet but I'm not even sure
the window functions can be used in CREATE TABLE or CREATE INDEX
statements anyway.
This commit fixes a regression which was introduced in commit
788134eee6 which broke the parsing of row
values.
It also makes sure CHECK expressions are parsed in exactly the same way,
no matter whether they are a column or a table constraint. Before spaces
were added to the query in a different way. The way it was done for
column constaints had also an error were the minus sign of a negative
number was separated from the first digit by a space. This is fixed,
too.
Because of all the changes this commit also adjusts the tests to expect
the new layout of the check expressions. It also adds some new tests for
row values and for complex expressions to make sure both work. Finally,
it also removes all QScintilla dependencies from the tests which don't
seem to be necessary.
This fixes parsing of expressions of the form '(x) AND/OR y' and similar
types. It also fixes expression of the '(x)' type and of the '(x op y
AND z op w)' type.
See issue #1454.
This commit adds support for CREATE INDEX statements to our grammar
parser. The new parser is called for each index when reloading the
database schema. However, the resulting index representation isn't used
yet. Also note that this duplicates some code, though not much. The idea
is to consolidate this later in a way that includes triggers and views
as well.
This fixes two issues with unusual but valid data types for columns:
1) When having a data type that consists of more than one word these
wouldn't be separated anymore after parsing. This is fixed now. Example:
CREATE TABLE test(a long int);
would have become
CREATE TABLE test(a longint);
2) Some keywords are allowed to be used as data types. Parsing these
tables would have failed entire prior to this. This is fixed, too.
Example:
CREATE TABLE test(a no);
would fail.
This fixes tables like these where a keyword (in this case NO) is used
as an unquoted default value for a column:
CREATE TABLE test(a DEFAULT NO);
See issue #877.
This adds basic support for parsing CREATE VIRTUAL TABLE statements to
the grammar parser.
This doesn't mean that those tables are handled correctly at all.
Especially editing them and browsing them isn't working. But it didn't
work before this either.
See issue #917.
SQLite version 3.15.0 introduced a new feature called row values. These
are basically vectors of values that can be used to simplify some
expressions.
For example instead of this
CREATE TABLE x(a int, b int, c int, CHECK(a=1 and b=2));
you could write this:
CREATE TABLE x(a int, b int, c int, CHECK((a,b) = (1,2)));
However, the new syntax wasn't supported by our grammar parser which
made it impossible to access or edit that table. This commit attempts to
fix this.
When specifying a table name along with a column name you have to put a
dot between them. This wasn't taken into account by our grammar parser,
an error which could lead up to misinterpretations in other places as
well.
See issue #505.
This adds support for escaping backticks inside an identifier using
backticks as quote characters by adding a second backtick following the
first one (e.g. `test``test` => 'test`test').
Fix parsing of table definitions like this one where there is a complex
check constraint using string literals:
CREATE TABLE "a" (
`b` TEXT CHECK(`b`='A' or `b`='B')
);
The grammar parser would fail to parse this statement correctly prior to
this fix.
See issue #179.
SQL allows you to use two quote characters instead of just one in order
to escape them. Example: ['aa''bb'] is read as [aa'bb]. Add detection
for these doubled quote characters to our grammar parser.
See issue #128.
Fix table definitions like this...
CREATE TABLE [player_tech_branches]
(
[from_id] INTEGER NOT NULL REFERENCES [techs](id),
[to_id] INTEGER NOT NULL REFERENCES [techs](id),
UNIQUE ([from_id], [to_id]) PRIMARY KEY ([from_id], [to_id])
)
...where there are multiple keys which are not separated by commas.
This partially fixed EoD's database in issue #63.
Allow ON INSERT in foreign key clauses like this:
CREATE TABLE x
(
y INTEGER REFERENCES ref(id) ON INSERT CASCADE
)
Note that ON INSERT is allowed by SQLite but missing in the SQLite
documentation.
This partially fixes EoD's problem in issue #63.
Parse column constraints with a 'NOT LIKE' expression correctly. For
example in a table definition like this:
CREATE TABLE not_working(
value TEXT CONSTRAINT "value" CHECK(value NOT LIKE "prefix%")
);
This fixes issue #40.
fixes issue #34
IN wasn't added to the token list and not enabled in the suffix expression
as this gives a parser generator warning, because of an ambiguity with IN as an operator
we stick with the warning right now
Allow NULL constraints in a column definition when parsing a CREATE
TABLE statement. Before this only NOT NULL constraints were parsed
correctly even though NULL is proper SQL as well - it's just a redundant
information.
Since version 3.8.2 SQLite supports tables without the internal rowid
column added to the table. For these tables the primary key serves as a
replacement for the rowid column.
These changes update the grammar parser to correctly handle 'without
rowid' tables and also generate 'without rowid' SQL statements.