Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Perl DBD::mysql - Clean a scalar, keep running after error.

by chargrill (Parson)
on Feb 07, 2007 at 03:45 UTC ( [id://598681]=note: print w/replies, xml ) Need Help??


in reply to Perl DBD::mysql - Clean a scalar, keep running after error.

Check DBI and look for "placeholder" and "bind_param" (primarily for the discussion therein - "execute" will bind your params to an insert statement if you pass it an array)

Quick example:

my $dbh; eval { $dbh = DBI->connect( $dsn, $user, $pass, { 'RaiseError' => 1 } +) }; my $insert_query = 'insert into queues values( ?, ?, ?, ?, ?, ?, ?, ?, + ? );'; my $st_handle; eval { $st_handle = $dbh->prepare( $insert_query ) }; eval { $st_handle->execute( @row_values ) };

Checking $@ after each call lets you handle the errors encountered your own way. (Example is woefully incomplete, but culled from an existing program. Modification is left as an exercise for the reader.)



--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

Replies are listed 'Best First'.
Re^2: Perl DBD::mysql - Clean a scalar, keep running after error.
by exodist (Monk) on Feb 07, 2007 at 04:37 UTC
    Thank you, I will give it a try tomorrow.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-19 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found