Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: error ..ON DUPLICATE KEY UPDATE value='''

by mje (Deacon)
on Aug 02, 2013 at 16:54 UTC ( #1047628=note: print w/ replies, xml ) Need Help??


in reply to Re: error ..ON DUPLICATE KEY UPDATE value='''
in thread error ..ON DUPLICATE KEY UPDATE value='''

Have you got DBI's RasieError set? Look for a call to DBI->connect and see if RaiseError => 1. If yes, then your call to do on line 14 just before your Dumper call will die and all your seeing in the Dumper output is from the last successful call and not the one that is failing. If so do:

eval { $dbh->do($sql); }; if (my $ev = $@) { print Dumper($sq); die $ev; }

Now you'll only get Dumper output for the failing case.


Comment on Re^2: error ..ON DUPLICATE KEY UPDATE value='''
Download Code
Re^3: error ..ON DUPLICATE KEY UPDATE value='''
by nafri (Initiate) on Aug 02, 2013 at 23:09 UTC
    RaiseError => 1 is set. the error i get now is this..
    $VAR1 = 'INSERT INTO products_features (product_id, feature_id, value) VALUES (5652151, , \'\') ON DUPLICATE KEY UPDATE value=\'\'';
    looks like the feature_id, value is empty here..What can i do to fix this..
      What values should be inserted? If a blank feature_id is valid, supply a NULL (no quotes). If it is not valid, then skip that record.
        thanks all of you.. i finally sorted it out.. i changed the function to this and it works
        if($prodid && $cat_featureid && $value){ my $sql = "INSERT INTO products_features (product_id, feature_id, +value) VALUES (".$prodid.", ".$cat_featureid.", ".$dbh->quote($value) +.") ON DUPLICATE KEY UPDATE value=".$dbh->quote($value); $dbh->do($sql); }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2014-07-30 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls