Possible bug in SQL-Statement: reports Bad predicate: '^1^'
From: Jon Warbrick (jw35_at_cam.ac.uk)
Date: 02/21/05
- Previous message: Shailesh Patel: "Accessing a MS Sqlserver 2000 database via Perl"
- Next in thread: Dean Arnold: "Re: Possible bug in SQL-Statement: reports Bad predicate: '^1^'"
- Reply: Dean Arnold: "Re: Possible bug in SQL-Statement: reports Bad predicate: '^1^'"
- Reply: Jeff Zucker: "Re: Possible bug in SQL-Statement: reports Bad predicate: '^1^'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 21 Feb 2005 10:01:45 +0000 (GMT) To: dbi-users@perl.org
I've just spent a while sorting out a program which uses DBD-CSV and
which broke when moved to a new machine with updated versions of most Perl
modules, reporting
SQL ERROR: Bad predicate: '^1^'!
The problem appears to be that the current version of SQL-Statement
(1.09) can't parse
SELECT col FROM tbl WHERE ((c1 = 1 OR c1 = 2) AND c2 = 1)
while the earlier version that I was using (0.1021) could. Both are happy
with
SELECT col FROM tbl WHERE (c1 = 1 OR c1 = 2) AND c2 = 1
I've no idea if the former is actually legal and/or supposed to be
supported by SQL-Statement but I thought it worth mentioning. The program
below (mildly adapted from the POD example) demonstrates the problem.
--cut--
#!/usr/bin/perl
use strict;
use warnings;
use SQL::Statement;
print "Using version $SQL::Statement::VERSION\n\n";
# Create a parser
my($parser) = SQL::Parser->new('Ansi');
# Parse an SQL statement
$@ = '';
my ($stmt) = eval {
SQL::Statement->new
("SELECT col FROM tbl WHERE ((c1 = 1 OR c1 = 2) AND c2 = 1)",$parser);
};
if ($@) {
die "Cannot parse statement: $@";
}
--cut--
Jon.
-- Jon Warbrick Web/News Development, Computing Service, University of Cambridge
- Previous message: Shailesh Patel: "Accessing a MS Sqlserver 2000 database via Perl"
- Next in thread: Dean Arnold: "Re: Possible bug in SQL-Statement: reports Bad predicate: '^1^'"
- Reply: Dean Arnold: "Re: Possible bug in SQL-Statement: reports Bad predicate: '^1^'"
- Reply: Jeff Zucker: "Re: Possible bug in SQL-Statement: reports Bad predicate: '^1^'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]