Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Quick DBI Fail Question

by jZed (Prior)
on Nov 07, 2007 at 23:40 UTC ( #649595=note: print w/replies, xml ) Need Help??

in reply to Quick DBI Fail Question

> my $emps = $dbh->fetch_rowarray( "Insert into...." );
There are at least five major errors in that short snippet. Use $dbh->do("INSERT INTO ...");

The best way to get DBI to produce errors is to set $dbh->{RaiseError} = 1 in your connection. Then any errors will cause your program to die with error messages. If you want to see the messages in a browser, you'll need to use something along the lines of Carp qw(fatalsToBrowser).

update The errors: 1) The method name is fetchrow_array, not fetch_rowarray 2) It is a statement handle method, not a database handle method 3) It is for fetching data from SELECT statements, not for INSERT 4) it doesn't accept SQL as a parameter. 5) It returns an array (go figure), not a scalar.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://649595]
[Corion]: Whoa! Somebody forwarded the AnyEvent::Impl:: Prima loop to schmorp and he's even interested in maintaining it himself - that'd be highly convenient for me ;)
[Corion]: (I also have a mail by dk who suggests some additions, which I should add this evening)
[ambrus]: Corion: um, that was me (duh)
[ambrus]: I just can't get you two to cooperate directly because schmorp doesn't want to be in the chatterbox

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2016-12-09 14:05 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (151 votes). Check out past polls.