You don't want to be using this directly - instead load the appropriate
one for your database, e.g. PK::Auto::SQLite
+=head1 LOGIC
+
+PK::Auto does this by letting the database assign the primary key field
+and fetching the assigned value afterwards.
+
=head1 METHODS
=head2 insert
sub last_insert_id {
my $self = shift;
$self->get_autoinc_seq unless $self->{_autoinc_seq};
- my $sql = "SELECT " . $self->{_autoinc_seq} . ".nextval FROM DUAL";
+ my $sql = "SELECT " . $self->{_autoinc_seq} . ".currval FROM DUAL";
my ($id) = $self->storage->dbh->selectrow_array($sql);
return $id;
}
# test primary key handling
my $new = OraTest::Artist->create({ name => 'foo' });
-ok($new->artistid, "Oracle Auto-PK worked");
+is($new->artistid, 1, "Oracle Auto-PK worked");
# test LIMIT support
for (1..6) {