zoophagous has asked for the wisdom of the Perl Monks concerning the following question:
If I comment out the prepare and execute the foreach loop.... well, it loops. If I leave the prepare and execute in place the loop terminates on the first iteration. No errors, throw, no error strings, nothing. The loop just doesn't execute. To make it stranger this code worked when I was using MSSQL with DBI. It only stopped working when I switched to MySql. Thanks in advance!my $dbh = DBI->connect("DBI:mysqlPP:host=localhost;database=foo",'bar' +,'baz',{ AutoCommit => 1, RaiseError => 1}); ... some stuff... foreach my $color (@color){ # trim whitespace $color =~ s/^\s+|\s+$//gm; # see if the color already exists in the color table. my $rowCheckQuery = qq{SELECT color_id FROM color W +HERE color=?}; my $sth = $dbh->prepare($rowCheckQuery); $sth->execute($color); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Having issues with DBI
by bradcathey (Prior) on Dec 11, 2008 at 02:44 UTC | |
|
Re: Having issues with DBI
by woodpeaker (Novice) on Dec 11, 2008 at 05:05 UTC | |
by zoophagous (Novice) on Dec 11, 2008 at 16:21 UTC | |
by perrin (Chancellor) on Dec 11, 2008 at 18:42 UTC | |
by zoophagous (Novice) on Dec 11, 2008 at 19:16 UTC | |
by perrin (Chancellor) on Dec 11, 2008 at 19:47 UTC | |
| |
by woodpeaker (Novice) on Dec 11, 2008 at 18:30 UTC | |
|
Re: Having issues with DBI
by perrin (Chancellor) on Dec 11, 2008 at 03:44 UTC | |
by Narveson (Chaplain) on Dec 11, 2008 at 06:16 UTC | |
by perrin (Chancellor) on Dec 11, 2008 at 16:09 UTC | |
by runrig (Abbot) on Dec 11, 2008 at 20:05 UTC | |
by perrin (Chancellor) on Dec 11, 2008 at 20:50 UTC | |
|
Re: Having issues with DBI
by Your Mother (Archbishop) on Jan 03, 2009 at 06:11 UTC |