Fwd: SQL::Statement (SQL-Statement-1.402_002)
Jens Rehsack <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.general |
|---|---|
| Organization | Comprehensive Perl Archive Network |
| Message-ID | <[email protected]> |
-------- Original Message -------- Subject: SQL::Statement (SQL-Statement-1.402_002) Date: Wed, 19 Dec 2012 15:53:31 +0100 From: Thomas Binder <[email protected]> To: [email protected] Hi there, I have a little problem with SQL-Statement. I installed it on two different systems (Linux+Windows) using Perl v5.14. The installation went w/o a hitch, also "make test" showed no issues : All tests successful. Test Summary Report ------------------- t/06virtual.t (Wstat: 0 Tests: 677 Failed: 0) TODO passed: 587-589 t/08join.t (Wstat: 0 Tests: 321 Failed: 0) TODO passed: 289-291, 293-295, 314, 316, 318, 321 Files=16, Tests=1639, 7 wallclock secs ( 0.55 usr 0.06 sys + 6.92 cusr 0.30 csys = 7.83 CPU) Result: PASS However, when I try your example from the docs of SQL::Statement::Structure use SQL::Statement; my $sql = "SELECT a FROM b JOIN c WHERE c=? AND e=7 ORDER BY f DESC LIMIT 5,2"; my $parser = SQL::Parser->new(); $parser->{RaiseError}=1; $parser->{PrintError}=0; # $parser->parse("LOAD 'MyLib::MySyntax' "); my $stmt = SQL::Statement->new($sql,$parser); printf "Command %s\n",$stmt->command; printf "Num of Placeholders %s\n",scalar $stmt->params; printf "Tables %s\n",join( ',', map {$_->name} $stmt->tables() ); printf "Where operator %s\n",join( ',', $stmt->where->op() ); printf "Limit %s\n",$stmt->limit(); printf "Offset %s\n",$stmt->offset(); printf "Columns %s\n",join( ',', map {$_->name} $stmt->column_defs() ); I get this result : Command SELECT Num of Placeholders 1 Tables b,c Where operator AND Limit 2 Offset 5 Can't call method "name" on unblessed reference at test.pl <http://test.pl> line 14. So, I'm unable to use *column_defs()* correctly. Any idea ? I would be happy, to hear from you. Best regards & A Merry Christmas Thomas Binder