cvsuser 03/07/18 20:48:21
Modified: P5EEx/Blue/P5EEx/Blue/Repository DBI.pm
Log:
fix error in store_rows when letting DB auto-assign ID's
Revision Changes Path
1.26 +12 -6 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.25
retrieving revision 1.26
diff -u -w -r1.25 -r1.26
--- DBI.pm 17 Jul 2003 17:47:51 -0000 1.25
+++ DBI.pm 19 Jul 2003 03:48:21 -0000 1.26
@@ -1,13 +1,13 @@
######################################################################
-## File: $Id: DBI.pm,v 1.25 2003/07/17 17:47:51 spadkins Exp $
+## File: $Id: DBI.pm,v 1.26 2003/07/19 03:48:21 spadkins Exp $
######################################################################
use P5EEx::Blue::P5EE;
use P5EEx::Blue::Repository;
package P5EEx::Blue::Repository::DBI;
-$VERSION = do { my @r=(q$Revision: 1.25 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
+$VERSION = do { my @r=(q$Revision: 1.26 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
@ISA = ( "P5EEx::Blue::Repository" );
@@ -1834,11 +1834,17 @@
else {
# next if (does not have permission to insert); (todo)
+ if (! $row->[$colidx{$pk_column}]) {
# if we need to automatically allocate an ID ...
- if ($auto_id && ! $row->[$colidx{$pk_column}]) {
+ if ($auto_id) {
$id = $self->next_id($table, $id);
$row->[$colidx{$pk_column}] = $id;
}
+ else { # give it 0 and let the DB assign an ID
+ $row->[$colidx{$pk_column}] = 0;
+ }
+ }
+
$ok = $self->insert_row($table,[EMAIL PROTECTED],$row);
$error = $self->error();