diff options
author | unknown <Sinisa@sinisa.nasamreza.org> | 2001-07-01 13:27:09 +0300 |
---|---|---|
committer | unknown <Sinisa@sinisa.nasamreza.org> | 2001-07-01 13:27:09 +0300 |
commit | cdfc04fb0819109ba3f7b78e87191b9b8311b9bf (patch) | |
tree | 6d24d9f1268cc8482f927f28041b09cd839de584 /sql/sql_delete.cc | |
parent | 2752103dba17e2c96f72e121b36fe4fd8b3e2d61 (diff) | |
parent | b291238171449fd01fb50b13631719382a73857c (diff) | |
download | mariadb-git-cdfc04fb0819109ba3f7b78e87191b9b8311b9bf.tar.gz |
Merge sinisa@work.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/hdc/Sinisa/mysql-4.0
BitKeeper/etc/ignore:
auto-union
sql/sql_delete.cc:
Auto merged
sql/sql_select.cc:
Auto merged
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r-- | sql/sql_delete.cc | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index d69d1cf9cfd..0f70bd71ddd 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB & Sinisa This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ #include "mysql_priv.h" #include "ha_innobase.h" +#include "sql_select.h" /* Optimize delete of all rows by doing a full generate of the table @@ -315,12 +316,14 @@ multi_delete::multi_delete(THD *thd_arg, TABLE_LIST *dt, #endif (void) dt->table->file->extra(HA_EXTRA_NO_READCHECK); + (void) dt->table->file->extra(HA_EXTRA_NO_KEYREAD); /* Don't use key read with MULTI-TABLE-DELETE */ dt->table->used_keys=0; for (dt=dt->next ; dt ; dt=dt->next,counter++) { TABLE *table=dt->table; - (void) table->file->extra(HA_EXTRA_NO_READCHECK); + (void) dt->table->file->extra(HA_EXTRA_NO_READCHECK); + (void) dt->table->file->extra(HA_EXTRA_NO_KEYREAD); #ifdef SINISAS_STRIP tempfiles[counter]=(IO_CACHE *) sql_alloc(sizeof(IO_CACHE)); if (open_cached_file(tempfiles[counter], mysql_tmpdir,TEMP_PREFIX, @@ -363,6 +366,39 @@ multi_delete::prepare(List<Item> &values) DBUG_RETURN(0); } +inline static void +link_in_list(SQL_LIST *list,byte *element,byte **next) +{ + list->elements++; + (*list->next)=element; + list->next=next; + *next=0; +} + +void +multi_delete::initialize_tables(JOIN *join) +{ + SQL_LIST *new_list=(SQL_LIST *) sql_alloc(sizeof(SQL_LIST)); + new_list->elements=0; new_list->first=0; + new_list->next= (byte**) &(new_list->first); + for (JOIN_TAB *tab=join->join_tab, *end=join->join_tab+join->tables; + tab < end; + tab++) + { + TABLE_LIST *walk; + for (walk=(TABLE_LIST*) delete_tables ; walk ; walk=walk->next) + if (!strcmp(tab->table->path,walk->table->path)) + break; + if (walk) // Table need not be the one to be deleted + { + register TABLE_LIST *ptr = (TABLE_LIST *) sql_alloc(sizeof(TABLE_LIST)); + memcpy(ptr,walk,sizeof(TABLE_LIST)); ptr->next=0; + link_in_list(new_list,(byte*) ptr,(byte**) &ptr->next); + } + } + delete_tables=(TABLE_LIST *)new_list->first; + return; +} multi_delete::~multi_delete() { |