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

Re: Re: Class::DBI find_or_create creating when shouldn't

by inblosam (Monk)
on Jun 01, 2004 at 21:53 UTC ( [id://358648]=note: print w/replies, xml ) Need Help??


in reply to Re: Class::DBI find_or_create creating when shouldn't
in thread Class::DBI find_or_create creating when shouldn't

Below is some of the code. The Class::DBI part works perfect everywhere else I am using it. I tried passing in the parameters directly in the find_or_create, and with the hash. I also tried not deferencing the hash in the find_or_create().
my %list_params = ( listnum => $listnum, address => $address, city => $city, state => $state, zip => $zip, tot_bed => $tot_bed, tot_bath => $tot_bath, tot_sqft => $tot_sqft, home_style => $home_style, home_type => $home_type, sch_element => $sch_element, sch_intermed=> $sch_intermed, sch_highsch => $sch_highsch, price => $price, photo => $photos[0][2], acres => $acres ); print Dumper(\%list_params); $addlisting = Table::Listings->find_or_create(\%list_params);
Both were added to the database for the following hashes, when in reality only the first should have:
$VAR1 = { 'sch_element' => 'Salina', 'home_style' => 'Manufact/Modular', 'photo' => 'http://photo.somesite.com/280x210/419964.jpg', 'tot_bed' => '3', 'acres' => '0.270000', 'tot_bath' => '2', 'state' => 'UT', 'home_type' => 'Single Family', 'zip' => '84614', 'city' => 'Salina', 'listnum' => '419764', 'price' => '88900', 'sch_highsch' => 'North Sevier', 'address' => ' SALINA CREEK DR', 'sch_intermed' => 'Red Hills', 'tot_sqft' => '1404' }; $VAR1 = { 'sch_element' => 'Salina', 'home_style' => 'Manufact/Modular', 'photo' => 'http://photo.somesite.com/280x210/419964.jpg', 'tot_bed' => '3', 'acres' => '0.270000', 'tot_bath' => '2', 'state' => 'UT', 'home_type' => 'Single Family', 'zip' => '84614', 'city' => 'Salina', 'listnum' => '419764', 'price' => '88900', 'sch_highsch' => 'North Sevier', 'address' => ' SALINA CREEK DR', 'sch_intermed' => 'Red Hills', 'tot_sqft' => '1404' };
In the following find_or_create the first attempt was added (blank table) and then the second one was not added. So this is how it is supposed to work, but again only 5 of 21 work properly.
$VAR1 = { 'sch_element' => 'Monroe', 'home_style' => 'Rambler/Ranch', 'photo' => 'http://photo.somesite.com/280x210/415584.jpg', 'tot_bed' => '5', 'acres' => '3.000000', 'tot_bath' => '1', 'state' => 'UT', 'home_type' => 'Single Family', 'zip' => '84777', 'city' => 'Annabella', 'listnum' => '415684', 'price' => '63900', 'sch_highsch' => 'South Sevier', 'address' => ' N ANNABELLA RD ', 'sch_intermed' => 'South Sevier', 'tot_sqft' => '2392' }; $VAR1 = { 'sch_element' => 'Monroe', 'home_style' => 'Rambler/Ranch', 'photo' => 'http://photo.somesite.com/280x210/415584.jpg', 'tot_bed' => '5', 'acres' => '3.000000', 'tot_bath' => '1', 'state' => 'UT', 'home_type' => 'Single Family', 'zip' => '84777', 'city' => 'Annabella', 'listnum' => '415684', 'price' => '63900', 'sch_highsch' => 'South Sevier', 'address' => ' N ANNABELLA RD ', 'sch_intermed' => 'South Sevier', 'tot_sqft' => '2392' };
Also if there is a / in the text it gets cut off after that, so it will say Manufact/ instead of Manufact/Modular in the field, or http:// instead of the full URL. Any ideas on that one too? I guess the other thing to do is just check the database if it comes up with a match and then if it doesn't just create the file like normal. Anyone come across similar problems? -Michael Jensen

Replies are listed 'Best First'.
Re: Re: Re: Class::DBI find_or_create creating when shouldn't
by perrin (Chancellor) on Jun 02, 2004 at 19:32 UTC
    I've never had problems like the ones you are talking about here. I'd suggest you turn on DBI_TRACE and look at the SQL that is being sent to the database.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-24 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found