I added the following to the top of your program to get a trackback dump:
use Carp;
$SIG{__DIE__} = \&Carp::confess;
This indicated that
DBD::AnyData is dying on the following line of code in the
ad_data method:
my $sth = $dbh->prepare("SELECT 1 FROM $table_name") or die DBI-
+>errstr;
I then wrote the following test program to exercise
SQL::Statement directly:
use common::sense;
use SQL::Statement;
my $sql1 = "SELECT 1+0 FROM some_table";
my $sql2 = "SELECT 1 FROM some_table";
my $parser = SQL::Parser->new();
for ($sql1, $sql2) {
warn "trying: $_";
my $stmt = SQL::Statement->new($_,$parser);
}
This produces:
trying: SELECT 1+0 FROM some_table at sql.pl line 10.
trying: SELECT 1 FROM some_table at sql.pl line 10.
Bad table or column name: '1' starts with non-alphabetic character! at
+ /usr/local/share/perl/5.10.0/SQL/Parser.pm line 2894.
So
"SELECT 1+0 from some_table" parses ok, but
"SELECT 1 from some_table" doesn't!
I started with SQL::Statement 1.20. The problem persisted after upgrading to 1.23.
Looks to me like a bug in SQL::Statement. Its not recognising the literal value '1' as a simple expression. My guess is that this has stopped working in the last few releases of SQL::Statement, but DBD::AnyData relies on it.
Update: I've created an rt ticket.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.