At 4:34 PM -0500 6/12/01, Erik Rantapaa wrote:
>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
Try using:
$dbh->do ("UPDATE ... WHERE k = ?", undef, "xxx")
and then access $dbh->{mysql_insertid} to see if you get a different
result. I suspect perhaps not, but it's something to try.
>
>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
>[EMAIL PROTECTED]
--
Paul DuBois, [EMAIL PROTECTED]
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php