mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix UNION
New faster list iterators Change list code to be simpler and faster Optimize count(distinct) New error messages for UNION Make create_tmp_table more general to be usable by UNION Docs/manual.texi: Changelog include/mysqld_error.h: Add new error messages needed for UNION mysql-test/r/union.result: New tests for UNION mysql-test/t/analyse.test: Add missing drop table mysql-test/t/union.test: new tests for UNION sql/Makefile.am: Change name of sql_unions.cc to sql_union.cc sql/item.cc: Use List_iterator_fast sql/item_cmpfunc.cc: Use List_iterator_fast sql/item_func.cc: Use List_iterator_fast sql/item_sum.cc: Use List_iterator_fast Optimize count(distinct) Cleanup of indentation and comments sql/item_sum.h: Optimize count(distinct) sql/key.cc: Use List_iterator_fast sql/mysql_priv.h: Add new option bits sql/opt_sum.cc: Use List_iterator_fast sql/share/Makefile.am: Add 'fix_errors' label sql/share/czech/errmsg.txt: Add new error messages needed for UNION sql/share/danish/errmsg.txt: Add new error messages needed for UNION sql/share/dutch/errmsg.txt: Add new error messages needed for UNION sql/share/english/errmsg.txt: Add new error messages needed for UNION sql/share/estonian/errmsg.txt: Add new error messages needed for UNION sql/share/french/errmsg.txt: Add new error messages needed for UNION sql/share/german/errmsg.txt: Add new error messages needed for UNION sql/share/greek/errmsg.txt: Add new error messages needed for UNION sql/share/hungarian/errmsg.txt: Add new error messages needed for UNION sql/share/italian/errmsg.txt: Add new error messages needed for UNION sql/share/japanese/errmsg.txt: Add new error messages needed for UNION sql/share/korean/errmsg.txt: Add new error messages needed for UNION sql/share/norwegian-ny/errmsg.txt: Add new error messages needed for UNION sql/share/norwegian/errmsg.txt: Add new error messages needed for UNION sql/share/polish/errmsg.txt: Add new error messages needed for UNION sql/share/portuguese/errmsg.txt: Add new error messages needed for UNION sql/share/romanian/errmsg.txt: Add new error messages needed for UNION sql/share/russian/errmsg.txt: Add new error messages needed for UNION sql/share/slovak/errmsg.txt: Add new error messages needed for UNION sql/share/spanish/errmsg.txt: Add new error messages needed for UNION sql/share/swedish/errmsg.txt: Add new error messages needed for UNION sql/sql_analyse.cc: Use List_iterator_fast sql/sql_base.cc: Use List_iterator_fast Add new argument to setup_fields sql/sql_class.cc: Use List_iterator_fast sql/sql_class.h: Create new class for UNION sql/sql_handler.cc: Use List_iterator_fast sql/sql_insert.cc: Use List_iterator_fast sql/sql_lex.h: Cleanup sql/sql_list.cc: Faster iteration of lists sql/sql_list.h: Faster iterations of lists sql/sql_load.cc: Use List_iterator_fast sql/sql_parse.cc: Fix UNION code sql/sql_select.cc: Use List_iterator_fast Make create_tmp_table more general to be usable by UNION sql/sql_select.h: Changes to speed up copy_fields() sql/sql_show.cc: Use List_iterator_fast sql/sql_table.cc: Use List_iterator_fast sql/sql_union.cc: Fix UNION code sql/sql_update.cc: Use List_iterator_fast sql/sql_yacc.yy: Fix UNION code
This commit is contained in:
@ -413,6 +413,8 @@ public:
|
||||
|
||||
class JOIN;
|
||||
|
||||
void send_error(NET *net,uint sql_errno=0, const char *err=0);
|
||||
|
||||
class select_result :public Sql_alloc {
|
||||
protected:
|
||||
THD *thd;
|
||||
@ -423,7 +425,10 @@ public:
|
||||
virtual bool send_fields(List<Item> &list,uint flag)=0;
|
||||
virtual bool send_data(List<Item> &items)=0;
|
||||
virtual void initialize_tables (JOIN *join=0) {}
|
||||
virtual void send_error(uint errcode,const char *err)=0;
|
||||
virtual void send_error(uint errcode,const char *err)
|
||||
{
|
||||
::send_error(&thd->net,errcode,err);
|
||||
}
|
||||
virtual bool send_eof()=0;
|
||||
virtual void abort() {}
|
||||
};
|
||||
@ -434,7 +439,6 @@ public:
|
||||
select_send() {}
|
||||
bool send_fields(List<Item> &list,uint flag);
|
||||
bool send_data(List<Item> &items);
|
||||
void send_error(uint errcode,const char *err);
|
||||
bool send_eof();
|
||||
};
|
||||
|
||||
@ -458,6 +462,7 @@ public:
|
||||
bool send_eof();
|
||||
};
|
||||
|
||||
|
||||
class select_dump :public select_result {
|
||||
sql_exchange *exchange;
|
||||
File file;
|
||||
@ -475,30 +480,31 @@ public:
|
||||
void send_error(uint errcode,const char *err);
|
||||
bool send_eof();
|
||||
};
|
||||
|
||||
|
||||
class select_insert :public select_result {
|
||||
public:
|
||||
TABLE *table;
|
||||
List<Item> *fields;
|
||||
uint save_time_stamp;
|
||||
ulonglong last_insert_id;
|
||||
COPY_INFO info;
|
||||
bool unions;
|
||||
uint save_time_stamp;
|
||||
|
||||
select_insert(TABLE *table_par,List<Item> *fields_par,enum_duplicates duplic, bool u=false)
|
||||
:table(table_par),fields(fields_par), save_time_stamp(0),last_insert_id(0)
|
||||
{
|
||||
bzero((char*) &info,sizeof(info));
|
||||
info.handle_duplicates=duplic; unions = u;
|
||||
}
|
||||
select_insert(TABLE *table_par,List<Item> *fields_par,enum_duplicates duplic)
|
||||
:table(table_par),fields(fields_par), last_insert_id(0), save_time_stamp(0) {
|
||||
bzero((char*) &info,sizeof(info));
|
||||
info.handle_duplicates=duplic;
|
||||
}
|
||||
~select_insert();
|
||||
int prepare(List<Item> &list);
|
||||
bool send_fields(List<Item> &list,
|
||||
uint flag) { return 0; }
|
||||
bool send_fields(List<Item> &list, uint flag)
|
||||
{ return 0; }
|
||||
bool send_data(List<Item> &items);
|
||||
void send_error(uint errcode,const char *err);
|
||||
bool send_eof();
|
||||
};
|
||||
|
||||
|
||||
class select_create: public select_insert {
|
||||
ORDER *group;
|
||||
const char *db;
|
||||
@ -513,8 +519,8 @@ public:
|
||||
HA_CREATE_INFO *create_info_par,
|
||||
List<create_field> &fields_par,
|
||||
List<Key> &keys_par,
|
||||
List<Item> &select_fields,enum_duplicates duplic, bool u=false)
|
||||
:select_insert (NULL, &select_fields, duplic, u), db(db_name),
|
||||
List<Item> &select_fields,enum_duplicates duplic)
|
||||
:select_insert (NULL, &select_fields, duplic), db(db_name),
|
||||
name(table_name), extra_fields(&fields_par),keys(&keys_par),
|
||||
create_info(create_info_par),
|
||||
lock(0)
|
||||
@ -525,6 +531,22 @@ public:
|
||||
void abort();
|
||||
};
|
||||
|
||||
class select_union :public select_result {
|
||||
public:
|
||||
TABLE *table;
|
||||
COPY_INFO info;
|
||||
uint save_time_stamp;
|
||||
|
||||
select_union(TABLE *table_par);
|
||||
~select_union();
|
||||
int prepare(List<Item> &list);
|
||||
bool send_fields(List<Item> &list, uint flag)
|
||||
{ return 0; }
|
||||
bool send_data(List<Item> &items);
|
||||
bool send_eof();
|
||||
bool flush();
|
||||
};
|
||||
|
||||
/* Structs used when sorting */
|
||||
|
||||
typedef struct st_sort_field {
|
||||
|
Reference in New Issue
Block a user