Re: mysql_insert_id Bug

Boyd Lynn Gerber <[email protected]>
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
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,


-- 
Boyd Gerber, Software Engineer & Support Specialist
MySQL AB, www.mysql.com

Are you MySQL certified?  www.mysql.com/certification



-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.