diff options
author | pem@mysql.com <> | 2004-03-25 17:48:00 +0100 |
---|---|---|
committer | pem@mysql.com <> | 2004-03-25 17:48:00 +0100 |
commit | e5f9e18d2ff4a85a876b187e9fb7a210396bd20c (patch) | |
tree | 0795028fc3c1987590aa4d86fbb5e55b6a4278b2 /sql/item_func.cc | |
parent | 3bf55c9a3d3186b2bec1d441484cc70f138accd0 (diff) | |
parent | 6395822932ab4830d80b4d90fbb3faa4b0ee8723 (diff) | |
download | mariadb-git-e5f9e18d2ff4a85a876b187e9fb7a210396bd20c.tar.gz |
Merge fix.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 5151fb2876d..9f80686e72c 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2139,13 +2139,22 @@ longlong Item_func_release_lock::val_int() } -longlong Item_func_set_last_insert_id::val_int() +longlong Item_func_last_insert_id::val_int() { DBUG_ASSERT(fixed == 1); - longlong value=args[0]->val_int(); - current_thd->insert_id(value); - null_value=args[0]->null_value; - return value; + if (arg_count) + { + longlong value=args[0]->val_int(); + current_thd->insert_id(value); + null_value=args[0]->null_value; + return value; + } + else + { + Item *it= get_system_var(current_thd, OPT_SESSION, "last_insert_id", 14, + "last_insert_id()"); + return it->val_int(); + } } /* This function is just used to test speed of different functions */ |