NYCPHP Meetup

NYPHP.org

[nycphp-talk] [Fwd: Re: mysql_insert_id Bug]

Hans Zaunere hans at nyphp.org
Wed Aug 13 09:22:52 EDT 2003


Just as followup to the mysql_insert_id() issue.  I've also attached the bk commit message that updated the mysql docs, and correctly indicates the actual behavior.

H


-------- Original Message --------
Subject: Re: mysql_insert_id Bug
Date: Wed, 13 Aug 2003 09:19:30 -0400
From: Hans Zaunere <hans at nyphp.org>
To: Boyd Lynn Gerber <bgerber at mysql.com>
CC: bugs at lists.mysql.com
References: <Pine.SC5.4.44.0308121109450.26580-100000 at xenau105.zenez.com>



Boyd Lynn Gerber wrote:

> On Tue, 11 Aug 2003, Hans Zaunere wrote:
> 
>>http://lists.mysql.com/list.php?9:mss:14894:200308:pgbmapllcppekmkmgbak
>>
>>I may have stumbled on some either incorrect, or incorrectly documented,
>>behavior with
>>mysql_insert_id() and I'd like to hear some feedback.
>>
>>>From http://www.mysql.com/doc/en/mysql_insert_id.html:
>>
>>"Note that mysql_insert_id() returns 0 if the previous query does not
>>generate an AUTO_INCREMENT
>>value."
>>
>>However, when inserting a non-unique value into a table with a UNIQUE
>>index, thus making
>>the INSERT fail and no AUTO_INCREMENT value being generated,
>>mysql_insert_id() returns
>>the value of the last successful INSERT statement.  I understand that this
>>is the correct
>>behavior for the SQL function LAST_INSERT_ID() (which is not reset between
>>queries),
>>however not for the C API function mysql_insert_id().
>>
>>Please see below for a C program that illustrates this, as well as my
>>current environment.
>>
>> Any insight would be helpful.  Thanks,
> 
> 
> The documentation is wrong.  We will get it updated

Thanks for looking into this.  I'll report this to the PHPdoc team so they can update as well.

Hans Zaunere
President, New York PHP
http://nyphp.org
hans at nyphp.org


-------------- next part --------------
An embedded message was scrubbed...
From: Sergei Golubchik <serg at mysql.com>
Subject: bk commit - mysqldoc tree (1.697)
Date: 13 Aug 2003 12:29:53 -0000
Size: 3259
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030813/32425514/attachment.eml>


More information about the talk mailing list