A fix of unions with duplicate rows and returning bug fix for lp:732124 union + limit returns wrong result
This commit is contained in:
parent
68929e8e3f
commit
e7606294b2
@ -5060,7 +5060,7 @@ public:
|
|||||||
select_value_catcher(Item_subselect *item_arg)
|
select_value_catcher(Item_subselect *item_arg)
|
||||||
:select_subselect(item_arg)
|
:select_subselect(item_arg)
|
||||||
{}
|
{}
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
int setup(List<Item> *items);
|
int setup(List<Item> *items);
|
||||||
bool assigned; /* TRUE <=> we've caught a value */
|
bool assigned; /* TRUE <=> we've caught a value */
|
||||||
uint n_elements; /* How many elements we get */
|
uint n_elements; /* How many elements we get */
|
||||||
@ -5088,7 +5088,7 @@ int select_value_catcher::setup(List<Item> *items)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool select_value_catcher::send_data(List<Item> &items)
|
int select_value_catcher::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("select_value_catcher::send_data");
|
DBUG_ENTER("select_value_catcher::send_data");
|
||||||
DBUG_ASSERT(!assigned);
|
DBUG_ASSERT(!assigned);
|
||||||
|
@ -517,7 +517,7 @@ int sp_cursor::Select_fetch_into_spvars::prepare(List<Item> &fields,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool sp_cursor::Select_fetch_into_spvars::send_data(List<Item> &items)
|
int sp_cursor::Select_fetch_into_spvars::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
List_iterator_fast<sp_variable> spvar_iter(*spvar_list);
|
List_iterator_fast<sp_variable> spvar_iter(*spvar_list);
|
||||||
List_iterator_fast<Item> item_iter(items);
|
List_iterator_fast<Item> item_iter(items);
|
||||||
|
@ -433,7 +433,7 @@ private:
|
|||||||
void set_spvar_list(List<sp_variable> *vars) { spvar_list= vars; }
|
void set_spvar_list(List<sp_variable> *vars) { spvar_list= vars; }
|
||||||
|
|
||||||
virtual bool send_eof() { return FALSE; }
|
virtual bool send_eof() { return FALSE; }
|
||||||
virtual bool send_data(List<Item> &items);
|
virtual int send_data(List<Item> &items);
|
||||||
virtual int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
virtual int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2458,7 +2458,7 @@ void select_send::cleanup()
|
|||||||
|
|
||||||
/* Send data to client. Returns 0 if ok */
|
/* Send data to client. Returns 0 if ok */
|
||||||
|
|
||||||
bool select_send::send_data(List<Item> &items)
|
int select_send::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
Protocol *protocol= thd->protocol;
|
Protocol *protocol= thd->protocol;
|
||||||
DBUG_ENTER("select_send::send_data");
|
DBUG_ENTER("select_send::send_data");
|
||||||
@ -2748,7 +2748,7 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
|
|||||||
(int) (uchar) (x) == line_sep_char || \
|
(int) (uchar) (x) == line_sep_char || \
|
||||||
!(x))
|
!(x))
|
||||||
|
|
||||||
bool select_export::send_data(List<Item> &items)
|
int select_export::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
|
|
||||||
DBUG_ENTER("select_export::send_data");
|
DBUG_ENTER("select_export::send_data");
|
||||||
@ -3007,7 +3007,7 @@ select_dump::prepare(List<Item> &list __attribute__((unused)),
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool select_dump::send_data(List<Item> &items)
|
int select_dump::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
List_iterator_fast<Item> li(items);
|
List_iterator_fast<Item> li(items);
|
||||||
char buff[MAX_FIELD_WIDTH];
|
char buff[MAX_FIELD_WIDTH];
|
||||||
@ -3055,7 +3055,7 @@ select_subselect::select_subselect(Item_subselect *item_arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool select_singlerow_subselect::send_data(List<Item> &items)
|
int select_singlerow_subselect::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("select_singlerow_subselect::send_data");
|
DBUG_ENTER("select_singlerow_subselect::send_data");
|
||||||
Item_singlerow_subselect *it= (Item_singlerow_subselect *)item;
|
Item_singlerow_subselect *it= (Item_singlerow_subselect *)item;
|
||||||
@ -3089,7 +3089,7 @@ void select_max_min_finder_subselect::cleanup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool select_max_min_finder_subselect::send_data(List<Item> &items)
|
int select_max_min_finder_subselect::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("select_max_min_finder_subselect::send_data");
|
DBUG_ENTER("select_max_min_finder_subselect::send_data");
|
||||||
Item_maxmin_subselect *it= (Item_maxmin_subselect *)item;
|
Item_maxmin_subselect *it= (Item_maxmin_subselect *)item;
|
||||||
@ -3206,7 +3206,7 @@ bool select_max_min_finder_subselect::cmp_str()
|
|||||||
return (sortcmp(val1, val2, cache->collation.collation) < 0);
|
return (sortcmp(val1, val2, cache->collation.collation) < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool select_exists_subselect::send_data(List<Item> &items)
|
int select_exists_subselect::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("select_exists_subselect::send_data");
|
DBUG_ENTER("select_exists_subselect::send_data");
|
||||||
Item_exists_subselect *it= (Item_exists_subselect *)item;
|
Item_exists_subselect *it= (Item_exists_subselect *)item;
|
||||||
@ -3589,7 +3589,7 @@ Statement_map::~Statement_map()
|
|||||||
my_hash_free(&st_hash);
|
my_hash_free(&st_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool select_dumpvar::send_data(List<Item> &items)
|
int select_dumpvar::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
List_iterator_fast<my_var> var_li(var_list);
|
List_iterator_fast<my_var> var_li(var_list);
|
||||||
List_iterator<Item> it(items);
|
List_iterator<Item> it(items);
|
||||||
@ -3695,7 +3695,7 @@ void select_materialize_with_stats::cleanup()
|
|||||||
@return FALSE on success
|
@return FALSE on success
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool select_materialize_with_stats::send_data(List<Item> &items)
|
int select_materialize_with_stats::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
List_iterator_fast<Item> item_it(items);
|
List_iterator_fast<Item> item_it(items);
|
||||||
Item *cur_item;
|
Item *cur_item;
|
||||||
|
@ -3466,7 +3466,7 @@ public:
|
|||||||
send_data returns 0 on ok, 1 on error and -1 if data was ignored, for
|
send_data returns 0 on ok, 1 on error and -1 if data was ignored, for
|
||||||
example for a duplicate row entry written to a temp table.
|
example for a duplicate row entry written to a temp table.
|
||||||
*/
|
*/
|
||||||
virtual bool send_data(List<Item> &items)=0;
|
virtual int send_data(List<Item> &items)=0;
|
||||||
virtual ~select_result_sink() {};
|
virtual ~select_result_sink() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3558,7 +3558,7 @@ public:
|
|||||||
TABLE *dst_table; /* table to write into */
|
TABLE *dst_table; /* table to write into */
|
||||||
|
|
||||||
/* The following is called in the child thread: */
|
/* The following is called in the child thread: */
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -3593,7 +3593,7 @@ class select_send :public select_result {
|
|||||||
public:
|
public:
|
||||||
select_send() :is_result_set_started(FALSE) {}
|
select_send() :is_result_set_started(FALSE) {}
|
||||||
bool send_result_set_metadata(List<Item> &list, uint flags);
|
bool send_result_set_metadata(List<Item> &list, uint flags);
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
bool send_eof();
|
bool send_eof();
|
||||||
virtual bool check_simple_select() const { return FALSE; }
|
virtual bool check_simple_select() const { return FALSE; }
|
||||||
void abort_result_set();
|
void abort_result_set();
|
||||||
@ -3656,7 +3656,7 @@ public:
|
|||||||
select_export(sql_exchange *ex) :select_to_file(ex) {}
|
select_export(sql_exchange *ex) :select_to_file(ex) {}
|
||||||
~select_export();
|
~select_export();
|
||||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -3664,7 +3664,7 @@ class select_dump :public select_to_file {
|
|||||||
public:
|
public:
|
||||||
select_dump(sql_exchange *ex) :select_to_file(ex) {}
|
select_dump(sql_exchange *ex) :select_to_file(ex) {}
|
||||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -3683,7 +3683,7 @@ class select_insert :public select_result_interceptor {
|
|||||||
~select_insert();
|
~select_insert();
|
||||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
virtual int prepare2(void);
|
virtual int prepare2(void);
|
||||||
virtual bool send_data(List<Item> &items);
|
virtual int send_data(List<Item> &items);
|
||||||
virtual void store_values(List<Item> &values);
|
virtual void store_values(List<Item> &values);
|
||||||
virtual bool can_rollback_data() { return 0; }
|
virtual bool can_rollback_data() { return 0; }
|
||||||
void send_error(uint errcode,const char *err);
|
void send_error(uint errcode,const char *err);
|
||||||
@ -3866,7 +3866,7 @@ public:
|
|||||||
|
|
||||||
select_union() :write_err(0), table(0), records(0) { tmp_table_param.init(); }
|
select_union() :write_err(0), table(0), records(0) { tmp_table_param.init(); }
|
||||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
bool send_eof();
|
bool send_eof();
|
||||||
bool flush();
|
bool flush();
|
||||||
void cleanup();
|
void cleanup();
|
||||||
@ -3885,7 +3885,7 @@ protected:
|
|||||||
Item_subselect *item;
|
Item_subselect *item;
|
||||||
public:
|
public:
|
||||||
select_subselect(Item_subselect *item);
|
select_subselect(Item_subselect *item);
|
||||||
bool send_data(List<Item> &items)=0;
|
int send_data(List<Item> &items)=0;
|
||||||
bool send_eof() { return 0; };
|
bool send_eof() { return 0; };
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3896,7 +3896,7 @@ public:
|
|||||||
select_singlerow_subselect(Item_subselect *item_arg)
|
select_singlerow_subselect(Item_subselect *item_arg)
|
||||||
:select_subselect(item_arg)
|
:select_subselect(item_arg)
|
||||||
{}
|
{}
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -3946,7 +3946,7 @@ public:
|
|||||||
bool bit_fields_as_long,
|
bool bit_fields_as_long,
|
||||||
bool create_table);
|
bool create_table);
|
||||||
bool init_result_table(ulonglong select_options);
|
bool init_result_table(ulonglong select_options);
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
void cleanup();
|
void cleanup();
|
||||||
ha_rows get_null_count_of_col(uint idx)
|
ha_rows get_null_count_of_col(uint idx)
|
||||||
{
|
{
|
||||||
@ -3980,7 +3980,7 @@ public:
|
|||||||
:select_subselect(item_arg), cache(0), fmax(mx), is_all(all)
|
:select_subselect(item_arg), cache(0), fmax(mx), is_all(all)
|
||||||
{}
|
{}
|
||||||
void cleanup();
|
void cleanup();
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
bool cmp_real();
|
bool cmp_real();
|
||||||
bool cmp_int();
|
bool cmp_int();
|
||||||
bool cmp_decimal();
|
bool cmp_decimal();
|
||||||
@ -3993,7 +3993,7 @@ class select_exists_subselect :public select_subselect
|
|||||||
public:
|
public:
|
||||||
select_exists_subselect(Item_subselect *item_arg)
|
select_exists_subselect(Item_subselect *item_arg)
|
||||||
:select_subselect(item_arg){}
|
:select_subselect(item_arg){}
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -4245,7 +4245,7 @@ public:
|
|||||||
multi_delete(TABLE_LIST *dt, uint num_of_tables);
|
multi_delete(TABLE_LIST *dt, uint num_of_tables);
|
||||||
~multi_delete();
|
~multi_delete();
|
||||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
bool initialize_tables (JOIN *join);
|
bool initialize_tables (JOIN *join);
|
||||||
void send_error(uint errcode,const char *err);
|
void send_error(uint errcode,const char *err);
|
||||||
int do_deletes();
|
int do_deletes();
|
||||||
@ -4293,7 +4293,7 @@ public:
|
|||||||
enum_duplicates handle_duplicates, bool ignore);
|
enum_duplicates handle_duplicates, bool ignore);
|
||||||
~multi_update();
|
~multi_update();
|
||||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
bool initialize_tables (JOIN *join);
|
bool initialize_tables (JOIN *join);
|
||||||
void send_error(uint errcode,const char *err);
|
void send_error(uint errcode,const char *err);
|
||||||
int do_updates();
|
int do_updates();
|
||||||
@ -4336,7 +4336,7 @@ public:
|
|||||||
select_dumpvar() { var_list.empty(); row_count= 0;}
|
select_dumpvar() { var_list.empty(); row_count= 0;}
|
||||||
~select_dumpvar() {}
|
~select_dumpvar() {}
|
||||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
bool send_data(List<Item> &items);
|
int send_data(List<Item> &items);
|
||||||
bool send_eof();
|
bool send_eof();
|
||||||
virtual bool check_simple_select() const;
|
virtual bool check_simple_select() const;
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
@ -759,7 +759,7 @@ multi_delete::~multi_delete()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool multi_delete::send_data(List<Item> &values)
|
int multi_delete::send_data(List<Item> &values)
|
||||||
{
|
{
|
||||||
int secure_counter= delete_while_scanning ? -1 : 0;
|
int secure_counter= delete_while_scanning ? -1 : 0;
|
||||||
TABLE_LIST *del_table;
|
TABLE_LIST *del_table;
|
||||||
|
@ -3537,7 +3537,7 @@ select_insert::~select_insert()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool select_insert::send_data(List<Item> &values)
|
int select_insert::send_data(List<Item> &values)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("select_insert::send_data");
|
DBUG_ENTER("select_insert::send_data");
|
||||||
bool error=0;
|
bool error=0;
|
||||||
|
@ -126,7 +126,7 @@ class Select_fetch_protocol_binary: public select_send
|
|||||||
public:
|
public:
|
||||||
Select_fetch_protocol_binary(THD *thd);
|
Select_fetch_protocol_binary(THD *thd);
|
||||||
virtual bool send_result_set_metadata(List<Item> &list, uint flags);
|
virtual bool send_result_set_metadata(List<Item> &list, uint flags);
|
||||||
virtual bool send_data(List<Item> &items);
|
virtual int send_data(List<Item> &items);
|
||||||
virtual bool send_eof();
|
virtual bool send_eof();
|
||||||
#ifdef EMBEDDED_LIBRARY
|
#ifdef EMBEDDED_LIBRARY
|
||||||
void begin_dataset()
|
void begin_dataset()
|
||||||
@ -3057,7 +3057,7 @@ bool Select_fetch_protocol_binary::send_eof()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
int
|
||||||
Select_fetch_protocol_binary::send_data(List<Item> &fields)
|
Select_fetch_protocol_binary::send_data(List<Item> &fields)
|
||||||
{
|
{
|
||||||
Protocol *save_protocol= thd->protocol;
|
Protocol *save_protocol= thd->protocol;
|
||||||
|
@ -2367,7 +2367,7 @@ void Show_explain_request::call_in_target_thread()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool select_result_explain_buffer::send_data(List<Item> &items)
|
int select_result_explain_buffer::send_data(List<Item> &items)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
THD *cur_thd= current_thd;
|
THD *cur_thd= current_thd;
|
||||||
|
@ -52,7 +52,7 @@ int select_union::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool select_union::send_data(List<Item> &values)
|
int select_union::send_data(List<Item> &values)
|
||||||
{
|
{
|
||||||
if (unit->offset_limit_cnt)
|
if (unit->offset_limit_cnt)
|
||||||
{ // using limit offset,count
|
{ // using limit offset,count
|
||||||
|
@ -1829,7 +1829,7 @@ multi_update::~multi_update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool multi_update::send_data(List<Item> ¬_used_values)
|
int multi_update::send_data(List<Item> ¬_used_values)
|
||||||
{
|
{
|
||||||
TABLE_LIST *cur_table;
|
TABLE_LIST *cur_table;
|
||||||
DBUG_ENTER("multi_update::send_data");
|
DBUG_ENTER("multi_update::send_data");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user