This really might be a DBI problem, but I find it's pretty weird.
I am attempting to perform atomic updates by using UPDATE statements
like:
UPDATE counter SET v = last_insert_id(v+1) WHERE k = 'xxx';
where counter has the schema: create table counter (k varchar(16) primary key, v int);
This works flawlessly through DBI when accessing a local database.
However, when accessing a remote database it sometimes fails. I can get
it to fail more often when I have multiple processes banging away at
the database with this same statement.
The exact failure is:
$sth = $dbh->prepare("UPDATE ... WHERE k = ?") succeeds
$sth->execute("xxx") succeeds
$sth->{mysql_insertid} is undefined
I've written a C program to test this query, and I can't get it to fail,
even with multiple concurrent queries running.
Has anyone seen this problem before?
Erik Rantapaa
rantapaa@stripped