Grammar: Fix multiple primary keys with conflict clause

Fix handling of multiple primary keys followed by a conflict clause like
in thix table definition:
CREATE TABLE [explore_records]
(
	[system_id] INTEGER NOT NULL REFERENCES [star_systems](id),
	[player_id] INTEGER NOT NULL REFERENCES [players](id),
	PRIMARY KEY ([player_id], [system_id]) ON CONFLICT ABORT
)

This partially fixes EoD's problem in issue #63.
This commit is contained in:
Martin Kleusberg
2014-07-26 21:07:50 +02:00
parent 7f007824fa
commit 8d23c77578

View File

@@ -312,8 +312,10 @@ Table CreateTableWalker::table()
int fieldindex = tab.findField(col);
if(fieldindex != -1)
tab.fields().at(fieldindex)->setPrimaryKey(true);
tc = tc->getNextSibling(); // skip ident and comma
tc = tc->getNextSibling();
do
{
tc = tc->getNextSibling(); // skip ident and comma
} while(tc->getType() == sqlite3TokenTypes::COMMA);
} while(tc != antlr::nullAST && tc->getType() != sqlite3TokenTypes::RPAREN);
}
break;