Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to find out the number of rows affected by an update statement and I'm not getting the right answer. My code loops through lots of data and performs an insert statement for each line. The insert statement contains a where clause which sometimes the data in the line matches and sometimes not. I am counting my inserts performed like so:
The value of $updates is less than the number of rows modified when i look in the database directly. I originally tried tested $rows_affected = 0 but I found that the do method returned 0E0 when nothing is inserted into the database. Any insight welcomed thanks$rows_affected = $dbh->do($insertstr, undef, ...parameter) if ($rows_affected ne "0E0") { $updates++; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Number of rows affected by an update command
by codeacrobat (Chaplain) on Nov 03, 2010 at 06:35 UTC | |
by ambrus (Abbot) on Nov 03, 2010 at 08:36 UTC | |
Re: Number of rows affected by an update command
by Tux (Canon) on Nov 03, 2010 at 08:50 UTC | |
by Anonymous Monk on Nov 03, 2010 at 20:48 UTC | |
by Tux (Canon) on Nov 04, 2010 at 07:36 UTC | |
Re: Number of rows affected by an update command
by JavaFan (Canon) on Nov 03, 2010 at 13:33 UTC | |
Re: Number of rows affected by an update command
by Anonymous Monk on Nov 03, 2010 at 01:05 UTC |