mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
5.0 version of the fix for bug #9481: mysql_insert_id() returns 0 after
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.
This commit is contained in:
@ -2048,7 +2048,8 @@ class select_insert :public select_result_interceptor {
|
||||
TABLE_LIST *table_list;
|
||||
TABLE *table;
|
||||
List<Item> *fields;
|
||||
ulonglong last_insert_id;
|
||||
ulonglong autoinc_value_of_last_inserted_row; // not autogenerated
|
||||
ulonglong autoinc_value_of_first_inserted_row; // autogenerated
|
||||
COPY_INFO info;
|
||||
bool insert_into_view;
|
||||
bool is_bulk_insert_mode;
|
||||
|
Reference in New Issue
Block a user