Skip Menu |
 

This queue is for tickets about the SQL-Translator CPAN distribution.

Report information
The Basics
Id: 4838
Status: new
Worked: 1 min
Priority: 0/
Queue: SQL-Translator

People
Owner: kclark [...] cpan.org
Requestors: altblue [...] n0i.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.04
Fixed in: 0.04

Attachments
sql-translator-mysql-parser.patch



MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
Subject: mysql parser fails on quoted fields/types etc (``)
Content-Type: multipart/mixed; boundary="----------=_1073337201-29683-0"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 345
Download (untitled) / with headers
text/plain 345b
- MySQL parser fails on `quoted` fields/indexes etc, so I switched some definitions from "WORD" to "NAME"; - replaced "default_val" definition with a more generic RE, allowing many more "default values" (all?) :) - turned global stripping of "'" in "default_val" with left/right trimming - updated VALUE definition to properly parse escaped "'"
Content-Type: text/x-patch; name="sql-translator-mysql-parser.patch"
Content-Disposition: inline; filename="sql-translator-mysql-parser.patch"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 2033
- MySQL parser fails on `quoted` fields/indexes etc, so I switched some definitions from "WORD" to "NAME"; - replaced "default_val" definition with a more generic RE, allowing many more "default values" (all?) :) - turned global stripping of "'" in "default_val" with left/right trimming - updated VALUE definition to properly parse escaped "'" --- lib/SQL/Translator/Parser/MySQL.pm.orig 2003-09-08 21:16:04.000000000 +0300 +++ lib/SQL/Translator/Parser/MySQL.pm 2004-01-05 20:59:57.000000000 +0200 @@ -161,7 +161,7 @@ | create | <error> -use : /use/i WORD ';' +use : /use/i NAME ';' { @table_comments = () } set : /set/i /[^;]+/ ';' @@ -169,10 +169,10 @@ drop : /drop/i TABLE /[^;]+/ ';' -drop : /drop/i WORD(s) ';' +drop : /drop/i NAME(s) ';' { @table_comments = () } -create : CREATE /database/i WORD ';' +create : CREATE /database/i NAME ';' { @table_comments = () } create : CREATE TEMPORARY(?) TABLE opt_if_not_exists(?) table_name '(' create_definition(s /,/) ')' table_option(s?) ';' @@ -364,9 +364,9 @@ field_name : NAME -index_name : WORD +index_name : NAME -data_type : WORD parens_value_list(s?) type_qualifier(s?) +data_type : NAME parens_value_list(s?) type_qualifier(s?) { my $type = $item[1]; my $size; # field size, applicable only to non-set fields @@ -435,7 +435,7 @@ type_qualifier : /(BINARY|UNSIGNED|ZEROFILL)/i { lc $item[1] } -field_type : WORD +field_type : NAME create_index : /create/i /index/i @@ -443,9 +443,9 @@ unsigned : /unsigned/i { $return = 0 } -default_val : /default/i /(?:')?[\s\w\d:.-]*(?:')?/ +default_val : /default/i /'(?:.*?\\')*.*?'|(?:')?[\w\d:.-]*(?:')?/ { - $item[2] =~ s/'//g; + $item[2] =~ s/^'|'$//g; $return = $item[2]; } @@ -543,7 +543,7 @@ VALUE : /[-+]?\.?\d+(?:[eE]\d+)?/ { $item[1] } - | /'.*?'/ + | /'(?:.*?\\')*.*?'/ { # remove leading/trailing quotes my $val = $item[1];
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
X-RT-Original-Encoding: iso-8859-1
Content-Length: 226
Download (untitled) / with headers
text/plain 226b
Sorry for the delay in responding. Can you provide a diff so I can make sure to apply all the changes you described? Also, please provide a minimum test case that fails with the current version? Thanks for the report! ky


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.