From: Dagfinn Ilmari Mannsåker Date: Mon, 30 Jun 2014 16:00:58 +0000 (+0100) Subject: Fix handling of quoted identifiers and strings in Parser::SQLite X-Git-Tag: v0.11021~16^2~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FSQL-Translator.git;a=commitdiff_plain;h=32d2b62fb6110c4637feee083bbb6dee08513d39 Fix handling of quoted identifiers and strings in Parser::SQLite --- diff --git a/lib/SQL/Translator/Parser/SQLite.pm b/lib/SQL/Translator/Parser/SQLite.pm index ddc9ea4..b3e81ae 100644 --- a/lib/SQL/Translator/Parser/SQLite.pm +++ b/lib/SQL/Translator/Parser/SQLite.pm @@ -619,18 +619,20 @@ UNIQUE : /unique/i { 1 } SEMICOLON : ';' -NAME : /["']?(\w+)["']?/ { $return = $1 } +NAME : /\w+/ + | DQSTRING + | SQSTRING -VALUE : /[-+]?\.?\d+(?:[eE]\d+)?/ +DQSTRING : '"' /((?:[^"]|"")+)/ '"' + { ($return = $item[2]) =~ s/""/"/g } + +SQSTRING : "'" /((?:[^']|'')*)/ "'" + { ($return = $item[2]) =~ s/''/'/g } + +VALUE : /[-+]?\d*\.?\d+(?:[eE]\d+)?/ { $item[1] } - | /'.*?'/ - { - # remove leading/trailing quotes - my $val = $item[1]; - $val =~ s/^['"]|['"]$//g; - $return = $val; - } - | /NULL/ + | SQSTRING + | /NULL/i { 'NULL' } | /CURRENT_TIMESTAMP/i { 'CURRENT_TIMESTAMP' }