Changeset 7 for trunk/lib/Data/ObjectDriver/Driver/DBI/Pg.pm
- Timestamp:
- 05/03/06 23:59:15 (4 years ago)
- Files:
-
- 1 modified
-
trunk/lib/Data/ObjectDriver/Driver/DBI/Pg.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Data/ObjectDriver/Driver/DBI/Pg.pm
r6 r7 24 24 my($class) = @_; 25 25 return join '_', $class->datasource, 'seq'; 26 } 26 } 27 27 28 sub generate_id {28 sub fetch_id { 29 29 my $driver = shift; 30 my($class) = @_; 31 my $seq = $driver->sequence_name($class); 32 my $dbh = $driver->rw_handle($class->properties->{db}); 33 my $sth = $dbh->prepare("SELECT NEXTVAL('$seq')") 34 or return $driver->error($dbh->errstr); 35 $sth->execute 36 or return $driver->error($dbh->errstr); 37 $sth->bind_columns(undef, \my($id)); 38 $sth->fetch; 39 $sth->finish; 40 $id; 30 my($dbh, $sth) = @_; 31 $dbh->last_insert_id(undef, undef, undef, undef, 32 { sequence => $driver->sequence_name }); 41 33 } 42 34
