diff options
author | unknown <gkodinov/kgeorge@macbook.gmz> | 2006-07-10 16:27:04 +0300 |
---|---|---|
committer | unknown <gkodinov/kgeorge@macbook.gmz> | 2006-07-10 16:27:04 +0300 |
commit | ca1e4aabfa9593dffe1ab6148e60fb303bad76de (patch) | |
tree | 4437469e222d2fb9090ff21c4fd71304ecca4e4e /sql | |
parent | 8cb368bcc37bb31fa7a2a2e1231801dcfbcf2385 (diff) | |
parent | 0806d9a86d73a1f1e089c9c3465c77ca82829b40 (diff) | |
download | mariadb-git-ca1e4aabfa9593dffe1ab6148e60fb303bad76de.tar.gz |
Merge rakia:mysql/4.1/B14553
into macbook.gmz:/Users/kgeorge/mysql/work/B14553-4.1-opt
sql/sql_class.cc:
SCCS merged
sql/sql_select.cc:
SCCS merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_class.cc | 1 | ||||
-rw-r--r-- | sql/sql_class.h | 3 | ||||
-rw-r--r-- | sql/sql_select.cc | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index acca4aaa4e0..48a7d3ac93e 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -265,6 +265,7 @@ THD::THD() ulong tmp=sql_rnd_with_mutex(); randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::query_id); } + substitute_null_with_insert_id = FALSE; } diff --git a/sql/sql_class.h b/sql/sql_class.h index d482a524934..006136a92f1 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -893,6 +893,8 @@ public: bool last_cuted_field; bool no_errors, password, is_fatal_error; bool query_start_used,last_insert_id_used,insert_id_used,rand_used; + /* for IS NULL => = last_insert_id() fix in remove_eq_conds() */ + bool substitute_null_with_insert_id; bool time_zone_used; bool in_lock_tables; bool query_error, bootstrap, cleanup_done; @@ -988,6 +990,7 @@ public: { last_insert_id= id_arg; insert_id_used=1; + substitute_null_with_insert_id= TRUE; } inline ulonglong insert_id(void) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index cb23662f42c..e9b7d954424 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4754,7 +4754,7 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value) Field *field=((Item_field*) args[0])->field; if (field->flags & AUTO_INCREMENT_FLAG && !field->table->maybe_null && (thd->options & OPTION_AUTO_IS_NULL) && - thd->insert_id()) + thd->insert_id() && thd->substitute_null_with_insert_id) { #ifdef HAVE_QUERY_CACHE query_cache_abort(&thd->net); @@ -4768,7 +4768,7 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value) cond=new_cond; cond->fix_fields(thd, 0, &cond); } - thd->insert_id(0); // Clear for next request + thd->substitute_null_with_insert_id= FALSE; // Clear for next request } /* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */ else if (((field->type() == FIELD_TYPE_DATE) || |