in reply to Re^2: Inserting into mysql and getting inserted id at the same time
in thread Inserting into mysql and getting inserted id at the same time

> I think what you proposed will indeed work for MySQL. I am curious why you think that it might not?

I didn't say it wouldn't work for MySQL, I said it wouldn't work for DBD::mysql. You can use both the Perl modules for both the databases. But DBD::MariaDB mentions "last_insert_id" as a function of both the database handle and the statement handle, but DBD::mysql only mentions $dbh->{'mysql_insertid'};. See also the Changes of the former and search for "insert_id" to see what's been fixed.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^4: Inserting into mysql and getting inserted id at the same time
by Marshall (Canon) on Mar 25, 2021 at 21:07 UTC
    Thank you!

    As I now understand it, DBD::mysql only does this on a per connection basis. The DBD::MariaDB driver can do it on a more refined basis, a per statement handle basis.

    If the OP is using one DB connection in multiple threads, the DBD::mysql driver won't work.