diff options
author | unknown <kostja@bodhi.local> | 2006-11-02 01:08:39 +0300 |
---|---|---|
committer | unknown <kostja@bodhi.local> | 2006-11-02 01:08:39 +0300 |
commit | 2886e07d3fa72d8aac8091c581adccb7a666a411 (patch) | |
tree | 5d5deeab993fb48853f3373233849f8d87d0423a /sql/item_func.cc | |
parent | 142a4485947b6f0af2ae010e59e723584197b6a0 (diff) | |
parent | 49c9509a5f485c73b12f9f971a274e2e31624a91 (diff) | |
download | mariadb-git-2886e07d3fa72d8aac8091c581adccb7a666a411.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into bodhi.local:/opt/local/work/mysql-4.1-runtime
mysql-test/r/ps.result:
Auto merged
mysql-test/t/func_gconcat.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_sum.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index fafefd460f9..1af49179aee 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2250,6 +2250,30 @@ longlong Item_func_release_lock::val_int() } +bool Item_func_last_insert_id::fix_fields(THD *thd, TABLE_LIST *tables, + Item **ref) +{ + DBUG_ASSERT(fixed == 0); + + if (Item_int_func::fix_fields(thd, tables, ref)) + return TRUE; + + if (arg_count == 0) + { + /* + As this statement calls LAST_INSERT_ID(), set + THD::last_insert_id_used. + */ + thd->last_insert_id_used= TRUE; + null_value= FALSE; + } + + thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); + + return FALSE; +} + + longlong Item_func_last_insert_id::val_int() { DBUG_ASSERT(fixed == 1); @@ -2259,12 +2283,13 @@ longlong Item_func_last_insert_id::val_int() longlong value=args[0]->val_int(); thd->insert_id(value); null_value=args[0]->null_value; + return value; } - else - thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); - return thd->last_insert_id_used ? thd->current_insert_id : thd->insert_id(); + + return thd->current_insert_id; } + /* This function is just used to test speed of different functions */ longlong Item_func_benchmark::val_int() |