cvsuser 03/03/14 08:51:38
Modified: P5EEx/Blue/P5EEx/Blue/Repository DBI.pm
Log:
don't fail if we supply dup rows in data to a store_rows() call
Revision Changes Path
1.22 +14 -5 p5ee/P5EEx/Blue/P5EEx/Blue/Repository/DBI.pm
Index: DBI.pm
===================================================================
RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Repository/DBI.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -w -r1.21 -r1.22
--- DBI.pm 21 Jan 2003 20:27:33 -0000 1.21
+++ DBI.pm 14 Mar 2003 16:51:38 -0000 1.22
@@ -1,13 +1,13 @@
######################################################################
-## File: $Id: DBI.pm,v 1.21 2003/01/21 20:27:33 spadkins Exp $
+## File: $Id: DBI.pm,v 1.22 2003/03/14 16:51:38 spadkins Exp $
######################################################################
use P5EEx::Blue::P5EE;
use P5EEx::Blue::Repository;
package P5EEx::Blue::Repository::DBI;
-$VERSION = do { my @r=(q$Revision: 1.21 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
+$VERSION = do { my @r=(q$Revision: 1.22 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
@ISA = ( "P5EEx::Blue::Repository" );
@@ -1693,7 +1693,7 @@
if (defined $row_crit) {
$oldrows = [];
- my ($tmprows);
+ my ($tmprows, %newrows);
$tmprows = $self->select_rows($table,[EMAIL PROTECTED],undef,$row_crit);
for ($rownum = 0; $rownum <= $#$tmprows; $rownum++) {
@@ -1705,7 +1705,16 @@
for ($rownum = 0; $rownum <= $#$rows; $rownum++) {
$row = $rows->[$rownum];
$key = join(",", @[EMAIL PROTECTED]);
+ if ($oldrows{$key}) {
$oldrows->[$rownum] = $oldrows{$key};
+ }
+ elsif ($newrows{$key}) { # we have a dup in our own data set!
+ $oldrows->[$rownum] = $newrows{$key};
+ }
+ else {
+ $oldrows->[$rownum] = undef;
+ }
+ $newrows{$key} = $row;
delete $oldrows{$key};
}
@@ -1793,7 +1802,7 @@
$context->dbgprint(" new=[", join(",",@$row), "]");
$error = $self->error();
$sql = $error ? $self->{sql} : "";
- $context->dbgprint(" diff=$different ok=$ok err=$error
$sql");
+ $context->dbgprint(" diff=$different (at
colidx=$colnum) ok=$ok err=$error $sql");
}
$nrows++ if ($ok);
}