Commit Graph

19 Commits

Author SHA1 Message Date
Martin Kleusberg
2dd0e9516f Grammar: Allow multiple table keys which are not separated by commas
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.
2014-07-26 21:41:12 +02:00
Martin Kleusberg
7f007824fa Grammar: Support ON INSERT in foreign key clauses
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.
2014-07-26 21:41:12 +02:00
Martin Kleusberg
64bcc42241 Grammar: Add 'NO' identifier
See issue #56.
2014-07-21 21:24:53 +02:00
Peinthor Rene
f3a2a74953 grammar: fix missing literalvalues in default constraint 2014-07-10 07:30:05 +02:00
Peinthor Rene
dd85b16660 grammar: cleanup expr and fix between suffix expression 2014-06-25 19:20:40 +02:00
Martin Kleusberg
d85672511c Grammar: Fix parsing of NOT IN/GLOB/MATCH/REGEXP constraints
See issue #40.
2014-06-23 12:37:09 +02:00
Martin Kleusberg
9cb0614ecf Grammar: Parse NOT LIKE constraints correctly
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.
2014-06-20 12:47:20 +02:00
Peinthor Rene
b02b36b2a2 fix create table statements with IN operator
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
2014-06-11 22:48:51 +02:00
Martin Kleusberg
6e5c98b653 Grammar: Allow 'NULL' constraints
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.
2014-06-04 20:50:08 +02:00
Martin Kleusberg
3761acfd02 Extend SQL grammar to recognise 'without rowid' tables correctly
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.
2014-05-09 14:46:42 +02:00
Peinthor Rene
d2246b79d7 grammar: fix column constrain
DEFAULT also takes quoted literals
2014-04-28 21:22:32 +02:00
Peinthor Rene
7ad887b0b3 Fix lexer to allow a lot more unicode characters in column and table identifier 2014-02-12 19:13:58 +01:00
Peinthor Rene
fd89ef72a6 Fix an issue with keywords in table or column names
note: table names are a bit more restrictive than column names
And btw. you can always have any name you want, just put it in quotes.
2013-11-24 10:23:55 +01:00
Peinthor Rene
e80f445c53 grammar: fix ambiguous string literal lexer part 2013-07-18 15:44:39 +02:00
Martin Kleusberg
ed04128a74 Grammar: Support table names in single quotes
Don't fail when parsing a CREATE statement like this:
CREATE TABLE 'test' (id INT);
2013-06-23 22:16:13 +02:00
Peinthor Rene
7bf3b87411 Fix incorrect single line comment syntax
Did never check if this syntax was correct,
now it should be fine see:
http://www.sqlite.org/lang_comment.html
2013-06-13 06:52:46 +02:00
Peinthor Rene
32ba32bbae add missing tokens
I hope I got all now
2013-05-03 21:10:10 +02:00
Peinthor Rene
ba6d51edf2 fix all warnings in the grammar and some bugs
literals were case sensitive so lower keywords broke parsing
2013-03-22 15:50:04 +01:00
Peinthor Rene
5737925079 Add a sqlite3 antlr2 "create table" grammar + generated parser files
There is also a "create table" ast walker which fills
info for the new sqlitetype objects.
A dependency to the antlr2 runtime was added.
The grammar most probably still contain bugs.
Why all this?
First writing grammars is fun and this is the only way
we can get all information for proper table editing + some time
in the future when the grammar is finished we can provide real
auto completion.
2013-03-16 20:18:57 +01:00