This bug is found using Java and the MM.MySQL driver, but I do not think it
is actually caused by the JDBC driver but rather comes from the MySQL
daemon. However, I am sending to both lists in case it is a driver problem.

The Last Insert ID can, of course,  be retrieved by executing the query
SELECT LAST_INSERT_ID(). However, MM.MySQL also offers the shortcut
Statement.getLastInsertID(), which I prefer to use believing it to be
quicker. This normally works. However, it seems to fail after executing a
command of the form
      INSERT INTO table VALUES (...), (...), ..., (...)
After executing this command, getLastInsertID() returns a value of 0,
whereas SELECT LAST INSERT_ID returns the correct value.

I attach a Java test program which demonstrates the fault. It should be
compiled then run using
      java AITest <hostname - often 127.0.0.1> <databasename - usually
test> <username> {<password>}

(See attached file: AITest.java)

OS: Windows 2000
MySQL: 4.0.2-alpha-max-nt, binary download
MM.MySQL: 1-14
Java: j2sdk 1.4.0_01

      Alec Cawley

mysql, query


---------------------------------------------------------------------
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

Reply via email to