Skip Menu |

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

Report information
The Basics
Id: 6988
Status: resolved
Priority: 0/
Queue: SQL-Statement

People
Owner: JZUCKER [...] cpan.org
Requestors: perlguy [...] perlguy.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.09
Fixed in: (no value)



Subject: db.table syntax
Valid queries like the following break in parsing: SELECT * FROM foo.bar, baz The 'foo.bar' hoses because of the ., but MySQL (at least) is fine with this syntax for multi-DB selects. Simple fix is to change the following line in Parser::Parser(): if ($id =~ /\W/) { to if ($id !~ /[\w.]/) { Doing anything more is up to you as far as splitting the DB part from the table part. I'm happy with it just not failing :-) Cheers, Kevin
Show quoted text
> Valid queries like the following break in parsing: > SELECT * FROM foo.bar, baz
That and other things in the form "table.column" work fine. I think you are refering to things like "schema.table.column" or "database.schema.table.column" which are not currently supported in the module. I will be adding support for those eventually, but, as per the documentation, they aren't currently supported. Sorry, and thanks for your report.
[JZUCKER - Sun Feb 27 14:52:05 2005]: Show quoted text
> > Valid queries like the following break in parsing: > > SELECT * FROM foo.bar, baz
> > That and other things in the form "table.column" work fine. I think you > are refering to things like "schema.table.column" or > "database.schema.table.column" which are not currently supported in the > module. I will be adding support for those eventually, but, as per the > documentation, they aren't currently supported. Sorry, and thanks for > your report. > >
Did you try it? If not, since the months I first submitted this report, here it is. Not working "fine", using code from your docs, with the SQL example I gave previously. # perl -MSQL::Parser -e 'print $SQL::Parser::VERSION'; 1.09 # perl t.pl Cannot parse statement: Parse error near .bar, baz at t.pl line 13. # cat t.pl #!/usr/local/bin/perl use SQL::Statement; my $q = qq{SELECT * FROM foo.bar, baz}; # Create a parser my $parser = SQL::Parser->new('Ansi'); # Parse an SQL statement $@ = ''; my ($stmt) = eval { SQL::Statement->new($q, $parser); }; if ($@) { die "Cannot parse statement: $@"; }
Show quoted text
>>> Valid queries like the following break in parsing: >>> SELECT * FROM foo.bar, baz
>> >>That and other things in the form "table.column" work fine
> >Did you try it?
Ooops, I did try, but mistakenly tested with SELECT foo.bar,baz FROM ... instead of as you showed it, sorry, you're entirely correct, it does not work in the FROM clause. That's the documented behaviour though. I have begun a rewrite which will add that, but it won't be in the next release. I'll put a note in the TO-DO section mentioning that it is on my list. Show quoted text
> If not, since the months I first submitted
Version 1.10 will be released this week containing many bug fixes and new features. I apologize for the length of time between your report and my answer, definitely appreciate your feedback, and hope to respond to future reports more quickly.