Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Saving data to XML file using DBD::AnyData

by snoopy (Deacon)
on Dec 04, 2009 at 07:02 UTC ( #811030=note: print w/ replies, xml ) Need Help??


in reply to Saving data to XML file using DBD::AnyData

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.


Comment on Re: Saving data to XML file using DBD::AnyData
Select or Download Code
Replies are listed 'Best First'.
Re^2: Saving data to XML file using DBD::AnyData
by warsting (Novice) on Dec 04, 2009 at 17:01 UTC

    Thanks for the in depth debugging. Being the AnyData module was new to me, I wasn't sure on how to get at that error message.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://811030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2015-07-07 23:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls