cvsuser     02/07/29 19:32:13

  Modified:    P5EEx/Blue/P5EEx/Blue/Repository DBI.pm
  Log:
  store_rows() now writes all possible rows rather than failing on a duplicate row
  
  Revision  Changes    Path
  1.15      +10 -4     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.14
  retrieving revision 1.15
  diff -u -w -r1.14 -r1.15
  --- DBI.pm    24 Jul 2002 19:58:11 -0000      1.14
  +++ DBI.pm    30 Jul 2002 02:32:13 -0000      1.15
  @@ -1,13 +1,13 @@
   
   ######################################################################
  -## File: $Id: DBI.pm,v 1.14 2002/07/24 19:58:11 spadkins Exp $
  +## File: $Id: DBI.pm,v 1.15 2002/07/30 02:32:13 spadkins Exp $
   ######################################################################
   
   use P5EEx::Blue::P5EE;
   use P5EEx::Blue::Repository;
   
   package P5EEx::Blue::Repository::DBI;
  -$VERSION = do { my @r=(q$Revision: 1.14 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
  +$VERSION = do { my @r=(q$Revision: 1.15 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
   
   @ISA = ( "P5EEx::Blue::Repository" );
   
  @@ -1677,6 +1677,7 @@
                   $sql = $error ? $self->{sql} : "";
                   $context->dbgprint("             diff=$different ok=$ok err=$error 
$sql");
               }
  +            $nrows++ if ($ok);
           }
           else {
               # next if (does not have permission to insert);  (todo)
  @@ -1687,17 +1688,22 @@
                   $row->[$colidx{$pk_column}] = $id;
               }
               $ok = $self->insert_row($table,\@insert_cols,$row);
  +            $error = $self->error();
   
               if ($P5EEx::Blue::DEBUG && $context->dbg(2)) {
                   $context->dbgprint("store_rows() new=[", join(",",@$row), "]");
  -                $error = $self->error();
                   $sql = $error ? $self->{sql} : "";
                   $context->dbgprint("                   ok=$ok err=$error $sql");
               }
  +            if ($ok) {
  +                $nrows++;
  +            }
  +            elsif ($error =~ /duplicate/i) {
  +                $ok = 1;
  +            }
           }
   
           last if (!$ok);
  -        $nrows++;
       }
   
       if (defined $row_crit && %oldrows) {
  
  
  


Reply via email to