Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: duplicate key check isn't, why not?

by eric256 (Parson)
on Nov 25, 2008 at 17:33 UTC ( [id://725889]=note: print w/replies, xml ) Need Help??


in reply to duplicate key check isn't, why not?

First think I do with code I don't understand is reformat it ;) So just in case its usefull to you i've included the reformatted code. All I really did was use slices so the arrays are readable and then edited the error messages to look similar. Once done it was fairly obvious that the error was on line #14 and that its using $mlg_addr_id which you distinctly specified shouldn't be defined. BTW i don't you sequnce of duplicate checks at all, it might make since but its hard to tell from this small sample of code.

$sth_mlg_addr_duplicate_check->execute(@fields[17,18,19,20,21,22,23]) or warn "While checking for duplicate mailing address " . "$fields[17]; $fields[19] $fields[20]: " . $dbh->errstr; ($mlg_addr_id) = $sth_mlg_addr_duplicate_check->fetchrow_array(); my $mlg_id; if(!defined($mlg_addr_id) && length($fields[20]) == 2) { #insert $sth_insert_mlg_addr->execute(@fields[17,18,19,20,21,22,23]) or warn "While inserting new mailing address " . "|$fields[17]|; |$fields[19]| |$fields[20]|, with id |$m +lg_addr_id|: " . $dbh->errstr; #check duplicate $sth_mlg_addr_duplicate_check->execute(@fields[17,18,19,20,21,22,23 +]) or warn "While checking for duplicate mailing address " . "|$fields[17]|; |$fields[19]| |$fields[20]|: " . $dbh->errstr; ($mlg_addr_id) = $sth_mlg_addr_duplicate_check->fetchrow_array(); $mlg_id = $mlg_addr_id; } else { $mlg_id = $mlg_addr_id; }


___________
Eric Hodges

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-20 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found