From: Ken Youens-Clark Date: Thu, 13 Aug 2009 15:54:30 +0000 (+0000) Subject: Fixes per RT#37814 (parsing of field/index names with double quotes, also fix X-Git-Tag: v0.11008~108 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6ceb5f1c1bbf3e434e82f2d312631c62b40b7efa;p=dbsrgits%2FSQL-Translator.git Fixes per RT#37814 (parsing of field/index names with double quotes, also fix to AUTOINCREMENT col attr). --- diff --git a/lib/SQL/Translator/Parser/SQLite.pm b/lib/SQL/Translator/Parser/SQLite.pm index c1db5c4..c4c2fe1 100644 --- a/lib/SQL/Translator/Parser/SQLite.pm +++ b/lib/SQL/Translator/Parser/SQLite.pm @@ -224,7 +224,7 @@ comment : /\/\*/ /[^\*]+/ /\*\// # # Create Index # -create : CREATE TEMPORARY(?) UNIQUE(?) INDEX WORD ON table_name parens_field_list conflict_clause(?) SEMICOLON +create : CREATE TEMPORARY(?) UNIQUE(?) INDEX NAME ON table_name parens_field_list conflict_clause(?) SEMICOLON { my $db_name = $item[7]->{'db_name'} || ''; my $table_name = $item[7]->{'name'}; @@ -304,6 +304,9 @@ column_def: comment(s?) NAME type(?) column_constraint(s?) elsif ( $c->{'type'} eq 'default' ) { $column->{'default'} = $c->{'value'}; } + elsif ( $c->{'type'} eq 'autoincrement' ) { + $column->{'is_auto_inc'} = 1; + } } $column; @@ -366,6 +369,13 @@ column_constraint : NOT_NULL conflict_clause(?) reference_fields => $item[2]{'reference_fields'}, } } + | + AUTOINCREMENT + { + $return = { + type => 'autoincrement', + } + } constraint_def : PRIMARY_KEY parens_field_list conflict_clause(?) { @@ -554,11 +564,13 @@ WHEN : /when/i REFERENCES : /references/i +AUTOINCREMENT : /autoincrement/i + UNIQUE : /unique/i { 1 } SEMICOLON : ';' -NAME : /'?(\w+)'?/ { $return = $1 } +NAME : /["']?(\w+)["']?/ { $return = $1 } VALUE : /[-+]?\.?\d+(?:[eE]\d+)?/ { $item[1] }