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

Re: Replacing DBI->do()

by mje (Curate)
on Apr 23, 2014 at 14:02 UTC ( #1083364=note: print w/replies, xml ) Need Help??


in reply to Replacing DBI->do()

Not ignoring Corion's comments the do should be something like

my $id = $dbh->do(q{INSERT INTO person (id, first_name, last_name) val +ues(?,?,?}, undef, undef, $first, $last});

that is, do($sql, undef, @bind_values). Also, notice I removed the trailing ';'. Also, I'm guessing your id field is actually auto generated for you by the database and a sequence or something in which case you can leave out the insert of the id entirely.

Also, your assignment to $id worries me as it will not be the id auto generated by the database.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1083364]
help
Chatterbox?
[Mr. Muskrat]: (considered) Re^3: Please help with Regexp::Common needs to be reparented to Re^2: Please help with Regexp::Common
[Mr. Muskrat]: Is it just me or does that timeout issue seems to be happening more often lately?
[Corion]: Mr. Muskrat: I'm not sure if it really happens more often, but I don't exactly know either
[LanX]: yep
[LanX]: more often for some weeks now

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2017-01-19 16:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (170 votes). Check out past polls.