• kaa@polly.(none)'s avatar
    5.0 version of the fix for bug #9481: mysql_insert_id() returns 0 after · 24c9d864
    kaa@polly.(none) authored
    insert ... select.
    
    The 5.0 manual page for mysql_insert_id() does not mention anything
    about INSERT ... SELECT, though its current behavior is incosistent
    with what the manual says about the plain INSERT.
    
    Fixed by changing the AUTO_INCREMENT and mysql_insert_id() handling
    logic in INSERT ... SELECT to be consistent with the INSERT behavior,
    the manual, and the changes in 5.1 introduced by WL3146:
    
    
    - mysql_insert_id() now returns the first automatically generated
    AUTO_INCREMENT value that was successfully inserted by INSERT ... SELECT
    
    -  if an INSERT ... SELECT statement is executed, and no automatically
    generated value is successfully inserted, mysql_insert_id() now returns
    the ID of the last inserted row.
    24c9d864
mysql_client_test.c 441 KB