->execute($value) does not return the rowid.
See last_insert_id of DBI on how to use ->last_insert_id. Also, you can use the RETURNING SQL clause:
my $sql = <<"SQL"; INSERT INTO $table ($column) VALUES (?) RETURNING id SQL my $sth = $dbh->prepare($sql); $sth->execute(...); my $rows = $sth->fetchall_arrayref( {} ); say "New id: " . $rows->[0]->{id};
In reply to Re: SQLite: INSERT into a unique column and retrieve rowid
by Corion
in thread SQLite: INSERT into a unique column and retrieve rowid
by ibm1620
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |