1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Merge rakia:mysql/4.1/B14553

into  macbook.gmz:/Users/kgeorge/mysql/work/B14553-4.1-opt
This commit is contained in:
gkodinov/kgeorge@macbook.gmz
2006-07-10 16:27:04 +03:00
7 changed files with 60 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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)
{

View File

@@ -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) ||