Commit 12411e8d authored by unknown's avatar unknown

Changes for multi-table delete and UNION's


mysql-test/t/multi_update.test:
  Made a test feasible. It will last very long time, so I will change 
  it again as soon as Monty pull's it
sql/sql_class.h:
  Some small changes
sql/sql_delete.cc:
  Fixed one bug in my stripping code
sql/sql_parse.cc:
  Additional stuff for UNION's
parent bf5a8692
......@@ -2,24 +2,35 @@ drop table if exists t1,t2,t3;
create table t1(id1 int not null auto_increment primary key, t char(12));
create table t2(id2 int not null, t char(12), index(id2));
create table t3(id3 int not null, t char(12), index(id3));
let $1 = 3;
let $1 = 10000;
while ($1)
{
let $2 = 3;
let $2 = 5;
eval insert into t1(t) values ('$1');
while ($2)
{
eval insert into t2(id2,t) values ($1,'$2');
eval insert into t3(id3,t) values ($1,'$2');
let $3 = 10;
while ($3)
{
eval insert into t3(id3,t) values ($1,'$2');
dec $3;
}
dec $2;
}
dec $1;
}
select * from t1;
select * from t2;
select * from t3;
delete from t1,t2 where t1.id = t2.id and t1.id = 3;
select * from t1;
select * from t2;
delete t1.*, t2.*, t3.* from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 9500;
check table t1, t2, t3;
select * from t1 where id1 > 9500;
select * from t2 where id2 > 9500;
select * from t3 where id3 > 9500;
delete t1, t2, t3 from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 500;
select * from t1 where id1 > 500;
select * from t2 where id2 > 500;
select * from t3 where id3 > 500;
......@@ -603,7 +603,8 @@ class Unique :public Sql_alloc
byte * dup_checking;
THD *thd;
ha_rows deleted;
int num_of_tables, error;
uint num_of_tables;
int error;
thr_lock_type lock_option;
bool do_delete;
public:
......
......@@ -347,7 +347,7 @@ multi_delete::~multi_delete()
for (uint counter = 0; counter < num_of_tables; counter++)
if (tempfiles[counter])
#ifdef SINISAS_STRIP
// end_io_cache(tempfiles[counter]);
end_io_cache(tempfiles[counter]);
#else
delete tempfiles[counter];
#endif
......@@ -549,12 +549,15 @@ static IO_CACHE *strip_duplicates_from_temp (byte *memory_lane, IO_CACHE *ptr, u
int read_error, write_error, how_many_to_read, total_to_read = *written, pieces_in_memory = 0, mem_count,written_rows;
int offset = written_rows=*written=0;
int mem_pool_size = MEM_STRIP_BUF_SIZE * MAX_REFLENGTH / ref_length;
IO_CACHE *tempptr = (IO_CACHE *) sql_alloc(sizeof(IO_CACHE));
byte dup_record[MAX_REFLENGTH]; memset(dup_record,'\xFF',MAX_REFLENGTH);
if (reinit_io_cache(ptr,READ_CACHE,0L,0,0))
return ptr;
IO_CACHE *tempptr = (IO_CACHE *) my_malloc(sizeof(IO_CACHE), MYF(MY_FAE | MY_ZEROFILL));
if (open_cached_file(tempptr, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE, MYF(MY_WME)))
{
my_free((gptr) tempptr, MYF (0));
return ptr;
}
DYNAMIC_ARRAY written_blocks;
VOID(init_dynamic_array(&written_blocks,sizeof(struct written_block),20,50));
for (;pieces_in_memory < total_to_read;)
......@@ -809,7 +812,7 @@ int multi_delete::do_deletes (bool from_send_error)
#ifdef SINISAS_STRIP
delete select;
#endif
if (error = -1) error = 0;
if (error == -1) error = 0;
#if 0
}
#endif
......
......@@ -2437,6 +2437,12 @@ mysql_new_select(LEX *lex)
SELECT_LEX *select_lex = (SELECT_LEX *)sql_calloc(sizeof(SELECT_LEX));
lex->select->next=select_lex;
lex->select=select_lex; lex->select->select_number = ++select_no;
lex->select->item_list = lex->select_lex.item_list;
lex->select->item_list.empty();
lex->select->table_list = lex->select_lex.table_list;
lex->select->table_list.elements=0;
lex->select->table_list.first=0;
lex->select->table_list.next= (byte**) &lex->select->table_list.first;
}
void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment