Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Answer: What are some common causes of syntax errors in queries?

( #7833=categorized answer: print w/ replies, xml ) Need Help??

Q&A > database programming > What are some common causes of syntax errors in queries? contributed by btrott

Are you checking for errors? The best way to do this is to set RaiseError to 1:
# do a $dbh = DBI->connect(...) $dbh->{'RaiseError'} = 1;
Then you'll see any errors that your database engine is giving you.

Also, try dumping out the hashref that you're getting back:

use Data::Dumper; while ($pointer = $sth->fetchrow_hashref) { print Dumper $pointer;
That'll show you what fields you're getting in the hash ref that you get back. You might also think about using bind_columns, since it's faster. More details in Tricks with DBI.

Comment on Answer: What are some common causes of syntax errors in queries?
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2015-08-01 02:16 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 (285 votes), past polls