Subject: | Problems with parsing multiline INSERT statment |
This example works well:
use SQL::Statement;
use Data::Dumper;
my $parser = SQL::Parser->new();
$parser->{RaiseError}=1;
$parser->{PrintError}=1;
my $sql = "INSERT INTO aaa VALUES ('aaa','bbb','ccc'),
('sss','ddd','eee')";
my $stmt = SQL::Statement->new($sql,$parser);
my @rowValues = $stmt->row_values();
print Dumper(\@rowValues);
but if fails when last or first member of inserted data is numeric
my $sql = "INSERT INTO aaa VALUES ('aaa','bbb''111),
('sss','ddd','eee')";
or
my $sql = "INSERT INTO aaa VALUES ('aaa','bbb','ccc'),
(222,'ddd','eee')";
Other examples seems to work well:
my $sql = "INSERT INTO aaa VALUES ('aaa','bbb',111)";
my $sql = "INSERT INTO aaa VALUES ('aaa','bbb','ccc'),
('sss','ddd',222)";
my $sql = "INSERT INTO aaa VALUES (222,'bbb','ccc'),
('sss','ddd','eee')";
PS:
$ perl -e'use SQL::Statement; print $SQL::Statement::VERSION,"\n"'
1.15
$ perl -v
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
Copyright 1987-2006, Larry Wall