summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item.h42
-rw-r--r--sql/item_cmpfunc.h30
-rw-r--r--sql/item_func.h46
-rw-r--r--sql/item_strfunc.h52
-rw-r--r--sql/item_sum.h34
-rw-r--r--sql/item_timefunc.h20
-rw-r--r--sql/item_uniq.h4
-rw-r--r--sql/mysql_priv.h1
-rw-r--r--sql/mysqld.cc27
-rw-r--r--sql/procedure.h8
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/share/czech/errmsg.txt2
-rw-r--r--sql/share/danish/errmsg.txt2
-rw-r--r--sql/share/dutch/errmsg.txt2
-rw-r--r--sql/share/english/errmsg.txt2
-rw-r--r--sql/share/estonian/errmsg.txt2
-rw-r--r--sql/share/french/errmsg.txt2
-rw-r--r--sql/share/german/errmsg.txt2
-rw-r--r--sql/share/greek/errmsg.txt2
-rw-r--r--sql/share/hungarian/errmsg.txt2
-rw-r--r--sql/share/italian/errmsg.txt2
-rw-r--r--sql/share/japanese/errmsg.txt2
-rw-r--r--sql/share/korean/errmsg.txt2
-rw-r--r--sql/share/norwegian-ny/errmsg.txt2
-rw-r--r--sql/share/norwegian/errmsg.txt2
-rw-r--r--sql/share/polish/errmsg.txt2
-rw-r--r--sql/share/portuguese/errmsg.txt2
-rw-r--r--sql/share/romanian/errmsg.txt2
-rw-r--r--sql/share/russian/errmsg.txt2
-rw-r--r--sql/share/slovak/errmsg.txt2
-rw-r--r--sql/share/spanish/errmsg.txt2
-rw-r--r--sql/share/swedish/errmsg.txt2
-rw-r--r--sql/share/ukrainian/errmsg.txt2
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_insert.cc1
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/sql_olap.cc15
-rw-r--r--sql/sql_parse.cc32
-rw-r--r--sql/sql_select.cc23
-rw-r--r--sql/sql_union.cc2
-rw-r--r--sql/sql_yacc.yy180
41 files changed, 365 insertions, 202 deletions
diff --git a/sql/item.h b/sql/item.h
index b31f6cf053a..a7ea48a45aa 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -82,7 +82,7 @@ public:
virtual bool get_date(TIME *ltime,bool fuzzydate);
virtual bool get_time(TIME *ltime);
virtual bool is_null() { return 0; }
- virtual unsigned int size_of () =0;
+ virtual unsigned int size_of()= 0;
};
@@ -97,7 +97,7 @@ public:
:db_name(db_name_par),table_name(table_name_par),field_name(field_name_par)
{ name = (char*) field_name_par; }
const char *full_name() const;
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -138,7 +138,7 @@ public:
bool get_date(TIME *ltime,bool fuzzydate);
bool get_time(TIME *ltime);
bool is_null() { return field->is_null(); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -160,7 +160,7 @@ public:
bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_null(name); }
bool is_null() { return 1; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -190,7 +190,7 @@ public:
bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_int(name,value,max_length); }
void print(String *str);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -205,7 +205,7 @@ public:
void make_field(Send_field *field);
Item *new_item() { return new Item_uint(name,max_length); }
void print(String *str);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -236,7 +236,7 @@ public:
void make_field(Send_field *field);
bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_real(name,value,decimals,max_length); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -248,7 +248,7 @@ public:
decimals=NOT_FIXED_DEC;
max_length=DBL_DIG+8;
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_string :public Item
@@ -282,7 +282,7 @@ public:
String *const_string() { return &str_value; }
inline void append(char *str,uint length) { str_value.append(str,length); }
void print(String *str);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
/* for show tables */
@@ -293,7 +293,7 @@ public:
Item_datetime(const char *item_name): Item_string(item_name,"",0)
{ max_length=19;}
void make_field(Send_field *field);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_empty_string :public Item_string
@@ -301,7 +301,7 @@ class Item_empty_string :public Item_string
public:
Item_empty_string(const char *header,uint length) :Item_string("",0)
{ name=(char*) header; max_length=length;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_varbinary :public Item
@@ -316,7 +316,7 @@ public:
bool save_in_field(Field *field);
void make_field(Send_field *field);
enum Item_result result_type () const { return INT_RESULT; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -329,7 +329,7 @@ public:
Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return result_field; }
table_map used_tables() const { return 1; }
virtual void fix_length_and_dec()=0;
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -379,7 +379,7 @@ public:
void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); }
enum Item_result result_type () const { return (*ref)->result_type(); }
table_map used_tables() const { return (*ref)->used_tables(); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -399,7 +399,7 @@ public:
{
return ref->save_in_field(field);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -434,7 +434,7 @@ public:
table_map used_tables() const { return (table_map) 1L; }
bool const_item() const { return 0; }
bool is_null() { return null_value; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -445,7 +445,7 @@ public:
Item_buff() :null_value(0) {}
virtual bool cmp(void)=0;
virtual ~Item_buff(); /*line -e1509 */
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_str_buff :public Item_buff
@@ -456,7 +456,7 @@ public:
Item_str_buff(Item *arg) :item(arg),value(arg->max_length) {}
bool cmp(void);
~Item_str_buff(); // Deallocate String:s
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -467,7 +467,7 @@ class Item_real_buff :public Item_buff
public:
Item_real_buff(Item *item_par) :item(item_par),value(0.0) {}
bool cmp(void);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_int_buff :public Item_buff
@@ -477,7 +477,7 @@ class Item_int_buff :public Item_buff
public:
Item_int_buff(Item *item_par) :item(item_par),value(0) {}
bool cmp(void);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -494,7 +494,7 @@ public:
buff= (char*) sql_calloc(length=field->pack_length());
}
bool cmp(void);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
extern Item_buff *new_Item_buff(Item *item);
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 8cda0302af5..9d83a8a9673 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -28,7 +28,7 @@ public:
Item_bool_func(Item *a) :Item_int_func(a) {}
Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {}
void fix_length_and_dec() { decimals=0; max_length=1; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_bool_func2 :public Item_int_func
@@ -48,7 +48,7 @@ public:
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
void print(String *str) { Item_func::print_op(str); }
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -82,7 +82,7 @@ public:
enum Functype rev_functype() const { return EQUAL_FUNC; }
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "<=>"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -188,7 +188,7 @@ public:
~Item_func_interval() { delete item; }
const char *func_name() const { return "interval"; }
void update_used_tables();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -203,7 +203,7 @@ public:
enum Item_result result_type () const { return cached_result_type; }
void fix_length_and_dec();
const char *func_name() const { return "ifnull"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -218,7 +218,7 @@ public:
enum Item_result result_type () const { return cached_result_type; }
void fix_length_and_dec();
const char *func_name() const { return "if"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -233,7 +233,7 @@ public:
enum Item_result result_type () const { return cached_result_type; }
void fix_length_and_dec();
const char *func_name() const { return "nullif"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -248,7 +248,7 @@ public:
void fix_length_and_dec();
enum Item_result result_type () const { return cached_result_type; }
const char *func_name() const { return "coalesce"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_case :public Item_func
@@ -269,7 +269,7 @@ public:
void print(String *str);
bool fix_fields(THD *thd,struct st_table_list *tlist);
Item *find_item(String *str);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -431,7 +431,7 @@ class Item_func_in :public Item_int_func
enum Functype functype() const { return IN_FUNC; }
const char *func_name() const { return " IN "; }
void update_used_tables();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -469,7 +469,7 @@ public:
}
}
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_isnotnull :public Item_bool_func
@@ -484,7 +484,7 @@ public:
}
const char *func_name() const { return "isnotnull"; }
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_like :public Item_bool_func2
@@ -518,7 +518,7 @@ public:
const char *func_name() const { return "like"; }
void fix_length_and_dec();
bool fix_fields(THD *thd,struct st_table_list *tlist);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
#ifdef USE_REGEX
@@ -538,7 +538,7 @@ public:
longlong val_int();
bool fix_fields(THD *thd,struct st_table_list *tlist);
const char *func_name() const { return "regex"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
#else
@@ -575,7 +575,7 @@ public:
void print(String *str);
void split_sum_func(List<Item> &fields);
friend int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/item_func.h b/sql/item_func.h
index 6ecbc04ddf0..846d99a29d2 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -121,7 +121,7 @@ public:
}
bool is_null() { (void) val_int(); return null_value; }
friend class udf_handler;
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -141,7 +141,7 @@ public:
if (!t_arg) return result_field;
return new Field_double(max_length, maybe_null, name,t_arg,decimals);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_num_func :public Item_func
@@ -156,7 +156,7 @@ public:
enum Item_result result_type () const { return hybrid_type; }
void fix_length_and_dec() { fix_num_length_and_dec(); }
bool is_null() { (void) val(); return null_value; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -190,7 +190,7 @@ class Item_num_op :public Item_func
res= new Field_double(max_length, maybe_null, name, t_arg, decimals);
return res;
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -463,7 +463,7 @@ public:
const char *func_name() const { return truncate ? "truncate" : "round"; }
double val();
void fix_length_and_dec();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -499,7 +499,7 @@ class Item_func_units :public Item_real_func
double val();
const char *func_name() const { return name; }
void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -516,7 +516,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
enum Item_result result_type () const { return cmp_type; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_min :public Item_func_min_max
@@ -542,7 +542,7 @@ public:
longlong val_int();
const char *func_name() const { return "length"; }
void fix_length_and_dec() { max_length=10; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_bit_length :public Item_func_length
@@ -561,7 +561,7 @@ public:
longlong val_int();
const char *func_name() const { return "char_length"; }
void fix_length_and_dec() { max_length=10; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_locate :public Item_int_func
@@ -573,7 +573,7 @@ public:
const char *func_name() const { return "locate"; }
longlong val_int();
void fix_length_and_dec() { maybe_null=0; max_length=11; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -603,7 +603,7 @@ public:
const_item_cache&= item->const_item();
with_sum_func= with_sum_func || item->with_sum_func;
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -615,7 +615,7 @@ public:
longlong val_int();
const char *func_name() const { return "ascii"; }
void fix_length_and_dec() { max_length=3; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_ord :public Item_int_func
@@ -625,7 +625,7 @@ public:
Item_func_ord(Item *a) :Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "ord"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_find_in_set :public Item_int_func
@@ -638,7 +638,7 @@ public:
longlong val_int();
const char *func_name() const { return "find_in_set"; }
void fix_length_and_dec();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -714,7 +714,7 @@ class Item_func_benchmark :public Item_int_func
longlong val_int();
const char *func_name() const { return "benchmark"; }
void fix_length_and_dec() { max_length=1; maybe_null=0; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -739,7 +739,7 @@ public:
return res;
}
Item_result result_type () const { return udf.result_type(); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -848,7 +848,7 @@ class Item_func_get_lock :public Item_int_func
longlong val_int();
const char *func_name() const { return "get_lock"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_release_lock :public Item_int_func
@@ -859,7 +859,7 @@ class Item_func_release_lock :public Item_int_func
longlong val_int();
const char *func_name() const { return "release_lock"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
/* replication functions */
@@ -872,7 +872,7 @@ class Item_master_pos_wait :public Item_int_func
longlong val_int();
const char *func_name() const { return "master_pos_wait"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -898,7 +898,7 @@ public:
void fix_length_and_dec();
void print(String *str);
const char *func_name() const { return "set_user_var"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -923,7 +923,7 @@ public:
table_map used_tables() const
{ return const_var_flag ? 0 : RAND_TABLE_BIT; }
bool eq(const Item *item, bool binary_cmp) const;
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -979,7 +979,7 @@ public:
bool fix_index();
void init_search(bool no_order);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -1030,5 +1030,5 @@ public:
longlong val_int();
const char *func_name() const { return "check_lock"; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index efff9d93941..482bf499757 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -40,7 +40,7 @@ public:
if (!t_arg) return result_field;
return (max_length > 255) ? (Field *)new Field_blob(max_length,maybe_null, name,t_arg, binary) : (Field *) new Field_string(max_length,maybe_null, name,t_arg, binary);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_md5 :public Item_str_func
@@ -51,7 +51,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "md5"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_sha :public Item_str_func
@@ -91,7 +91,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "concat"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_concat_ws :public Item_str_func
@@ -112,7 +112,7 @@ public:
|| Item_func::fix_fields(thd,tlist));
}
const char *func_name() const { return "concat_ws"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_reverse :public Item_str_func
@@ -133,7 +133,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "replace"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -146,7 +146,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "insert"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -193,7 +193,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "right"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -206,7 +206,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "substr"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -218,7 +218,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "substr_index"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -230,7 +230,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "ltrim"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -242,7 +242,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "rtrim"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_trim :public Item_str_func
@@ -253,7 +253,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "trim"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -265,7 +265,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { max_length = 16; }
const char *func_name() const { return "password"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_des_encrypt :public Item_str_func
@@ -278,7 +278,7 @@ public:
void fix_length_and_dec()
{ maybe_null=1; max_length = args[0]->max_length+8; }
const char *func_name() const { return "des_encrypt"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_des_decrypt :public Item_str_func
@@ -290,7 +290,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { maybe_null=1; max_length = args[0]->max_length; }
const char *func_name() const { return "des_decrypt"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_encrypt :public Item_str_func
@@ -301,7 +301,7 @@ public:
Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
String *val_str(String *);
void fix_length_and_dec() { maybe_null=1; max_length = 13; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
#include "sql_crypt.h"
@@ -315,7 +315,7 @@ public:
Item_str_func(a),sql_crypt(seed) {}
String *val_str(String *);
void fix_length_and_dec();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_decode :public Item_func_encode
@@ -353,7 +353,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "soundex"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -374,7 +374,7 @@ public:
void fix_length_and_dec();
void update_used_tables();
const char *func_name() const { return "elt"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -394,7 +394,7 @@ public:
void fix_length_and_dec();
void update_used_tables();
const char *func_name() const { return "make_set"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -409,7 +409,7 @@ public:
max_length=args[0]->max_length+(args[0]->max_length-args[0]->decimals)/3;
}
const char *func_name() const { return "format"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -431,7 +431,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "repeat"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -444,7 +444,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "rpad"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -457,7 +457,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "lpad"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -479,7 +479,7 @@ public:
const char *func_name() const { return "hex"; }
String *val_str(String *);
void fix_length_and_dec() { decimals=0; max_length=args[0]->max_length*2; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -504,7 +504,7 @@ public:
const char *func_name() const { return "load_file"; }
void fix_length_and_dec()
{ binary=1; maybe_null=1; max_length=MAX_BLOB_WIDTH;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 8326114629b..2cf92343ebb 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -70,7 +70,7 @@ public:
void print(String *str);
void fix_num_length_and_dec();
virtual bool setup(THD *thd) {return 0;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -85,7 +85,7 @@ public:
longlong val_int() { return (longlong) val(); } /* Real as default */
String *val_str(String*str);
void reset_field();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -100,7 +100,7 @@ public:
double val() { return (double) val_int(); }
String *val_str(String*str);
enum Item_result result_type () const { return INT_RESULT; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -118,7 +118,7 @@ class Item_sum_sum :public Item_sum_num
void reset_field();
void update_field(int offset);
const char *func_name() const { return "sum"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -141,7 +141,7 @@ class Item_sum_count :public Item_sum_int
void reset_field();
void update_field(int offset);
const char *func_name() const { return "count"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -193,7 +193,7 @@ class Item_sum_count_distinct :public Item_sum_int
void update_field(int offset) { return ; } // Never called
const char *func_name() const { return "count_distinct"; }
bool setup(THD *thd);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -213,7 +213,7 @@ public:
String *val_str(String*);
void make_field(Send_field *field);
void fix_length_and_dec() {}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -235,7 +235,7 @@ class Item_sum_avg :public Item_sum_num
Item *result_item(Field *field)
{ return new Item_avg_field(this); }
const char *func_name() const { return "avg"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_sum_std;
@@ -252,7 +252,7 @@ public:
bool is_null() { (void) val_int(); return null_value; }
void make_field(Send_field *field);
void fix_length_and_dec() {}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_sum_std :public Item_sum_num
@@ -273,7 +273,7 @@ class Item_sum_std :public Item_sum_num
Item *result_item(Field *field)
{ return new Item_std_field(this); }
const char *func_name() const { return "std"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -316,7 +316,7 @@ class Item_sum_hybrid :public Item_sum
void min_max_update_str_field(int offset);
void min_max_update_real_field(int offset);
void min_max_update_int_field(int offset);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -328,7 +328,7 @@ public:
bool add();
const char *func_name() const { return "min"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -340,7 +340,7 @@ public:
bool add();
const char *func_name() const { return "max"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -356,7 +356,7 @@ class Item_sum_bit :public Item_sum_int
void reset();
longlong val_int();
void reset_field();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -367,7 +367,7 @@ class Item_sum_or :public Item_sum_bit
bool add();
void update_field(int offset);
const char *func_name() const { return "bit_or"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -378,7 +378,7 @@ class Item_sum_and :public Item_sum_bit
bool add();
void update_field(int offset);
const char *func_name() const { return "bit_and"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
/*
@@ -409,7 +409,7 @@ public:
bool add();
void reset_field() {};
void update_field(int offset_arg) {};
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 08fbfe25093..6b0d1850d8c 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -175,7 +175,7 @@ public:
const char *func_name() const { return "weekday"; }
enum Item_result result_type () const { return INT_RESULT; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_dayname :public Item_func_weekday
@@ -201,7 +201,7 @@ public:
{
decimals=0; max_length=10;
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -240,7 +240,7 @@ public:
if (!t_arg) return result_field;
return new Field_date(maybe_null, name, t_arg);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -259,7 +259,7 @@ public:
if (!t_arg) return result_field;
return new Field_datetime(maybe_null, name, t_arg);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -287,7 +287,7 @@ public:
if (!t_arg) return result_field;
return new Field_time(maybe_null, name, t_arg);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -301,7 +301,7 @@ public:
const char *func_name() const { return "curdate"; }
void fix_length_and_dec(); /* Retrieves curtime */
bool get_date(TIME *res,bool fuzzy_date);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -323,7 +323,7 @@ public:
const char *func_name() const { return "now"; }
void fix_length_and_dec();
bool get_date(TIME *res,bool fuzzy_date);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -348,7 +348,7 @@ public:
const char *func_name() const { return "date_format"; }
void fix_length_and_dec();
uint format_length(const String *format);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -408,7 +408,7 @@ public:
double val() { return (double) val_int(); }
longlong val_int();
bool get_date(TIME *res,bool fuzzy_date);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_extract :public Item_int_func
@@ -422,7 +422,7 @@ class Item_extract :public Item_int_func
longlong val_int();
const char *func_name() const { return "extract"; }
void fix_length_and_dec();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_typecast :public Item_str_func
diff --git a/sql/item_uniq.h b/sql/item_uniq.h
index 18f5e5ca45e..cc087832f49 100644
--- a/sql/item_uniq.h
+++ b/sql/item_uniq.h
@@ -29,7 +29,7 @@ public:
:Item_real_func(list) {}
double val() { return 0.0; }
void fix_length_and_dec() { decimals=0; max_length=6; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_sum_unique_users :public Item_sum_num
@@ -44,5 +44,5 @@ public:
void reset_field() {}
void update_field(int offset) {}
bool fix_fields(THD *thd,struct st_table_list *tlist) { return 0;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 78db1ba2699..6dc70d0a86c 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -337,6 +337,7 @@ int mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
+bool check_simple_select();
/* net_pkg.c */
void send_warning(NET *net, uint sql_errno, const char *err=0);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c1d9f215da0..6c520ffe9ed 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -256,7 +256,7 @@ ulong back_log, connect_timeout;
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30];
bool opt_log, opt_update_log, opt_bin_log, opt_slow_log;
bool opt_disable_networking=0, opt_skip_show_db=0;
-my_bool opt_local_infile;
+my_bool opt_local_infile, opt_external_locking;
static bool opt_do_pstack = 0;
static ulong opt_specialflag=SPECIAL_ENGLISH;
@@ -2928,8 +2928,10 @@ struct my_option my_long_options[] =
{"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE,
"Don't flush key buffers between writes for any MyISAM table", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"enable-locking", OPT_ENABLE_LOCK, "Enable system locking", 0, 0, 0,
- GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"enable-locking", OPT_ENABLE_LOCK,
+ "Depricated option, use --external-locking instead",
+ (gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NT__
{"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT)",
(gptr*) &opt_enable_named_pipe, (gptr*) &opt_enable_named_pipe, 0, GET_BOOL,
@@ -3198,7 +3200,7 @@ struct my_option my_long_options[] =
{"skip-innodb", OPT_INNODB_SKIP, "Don't use Innodb (will save memory)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-locking", OPT_SKIP_LOCK,
- "Don't use system locking. To use isamchk one has to shut down the server.",
+ "Depricated option, use --skip-external-locking instead",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -3257,8 +3259,9 @@ struct my_option my_long_options[] =
"Default transaction isolation level", 0, 0, 0, GET_NO_ARG, REQUIRED_ARG, 0,
0, 0, 0,
0, 0},
- {"use-locking", OPT_USE_LOCKING, "Use system (external) locking",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"external-locking", OPT_USE_LOCKING, "Use system (external) locking. With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running",
+ (gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef USE_SYMDIR
{"use-symbolic-links", 's', "Enable symbolic link support",
(gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, 0, 0,
@@ -3835,9 +3838,8 @@ static void set_options(void)
(void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1);
#endif
-#if defined( HAVE_mit_thread ) || defined( __WIN__ ) || defined( HAVE_LINUXTHREADS )
my_disable_locking=myisam_single_user= 1;
-#endif
+ opt_external_locking=0;
my_bind_addr = htonl( INADDR_ANY );
}
@@ -4060,17 +4062,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_specialflag|= SPECIAL_NO_PRIOR;
break;
case (int) OPT_SKIP_LOCK:
- my_disable_locking=myisam_single_user= 1;
+ opt_external_locking=0;
break;
case (int) OPT_SKIP_HOST_CACHE:
opt_specialflag|= SPECIAL_NO_HOST_CACHE;
break;
- case (int) OPT_ENABLE_LOCK:
- my_disable_locking=myisam_single_user=0;
- break;
- case (int) OPT_USE_LOCKING:
- my_disable_locking=0;
- break;
case (int) OPT_SKIP_RESOLVE:
opt_specialflag|=SPECIAL_NO_RESOLVE;
break;
@@ -4323,6 +4319,7 @@ static void get_options(int argc,char **argv)
Set some global variables from the global_system_variables
In most cases the global variables will not be used
*/
+ my_disable_locking= myisam_single_user= test(opt_external_locking == 0);
my_default_record_cache_size=global_system_variables.read_buff_size;
myisam_max_temp_length=
(my_off_t) min(global_system_variables.myisam_max_sort_file_size,
diff --git a/sql/procedure.h b/sql/procedure.h
index d2600a62e62..349908a8d84 100644
--- a/sql/procedure.h
+++ b/sql/procedure.h
@@ -43,7 +43,7 @@ public:
{
init_make_field(tmp_field,field_type());
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_proc_real :public Item_proc
@@ -63,7 +63,7 @@ public:
double val() { return value; }
longlong val_int() { return (longlong) value; }
String *val_str(String *s) { s->set(value,decimals); return s; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_proc_int :public Item_proc
@@ -81,7 +81,7 @@ public:
double val() { return (double) value; }
longlong val_int() { return value; }
String *val_str(String *s) { s->set(value); return s; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -101,7 +101,7 @@ public:
{
return null_value ? (String*) 0 : (String*) &str_value;
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
/* The procedure class definitions */
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 1ec59c55b1b..ec8a9e83ed3 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -475,7 +475,7 @@ struct show_var_st init_vars[]= {
{sys_safe_show_db.name, (char*) &sys_safe_show_db, SHOW_SYS},
{sys_server_id.name, (char*) &sys_server_id, SHOW_SYS},
{sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
- {"skip_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
+ {"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
{sys_slow_launch_time.name, (char*) &sys_slow_launch_time, SHOW_SYS},
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index f5695a1aeb6..18b4c3ad2a8 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -244,3 +244,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index f758f3c6c4c..7d409e3133f 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -238,3 +238,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index 3081968c537..4a674999c82 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -244,3 +244,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 0e480d795c3..04150b67084 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 603560e31ed..2a0233ca949 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -240,3 +240,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 807312b41a2..42f83e6eed2 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index 5c0f222bb1b..0cd3f8cd902 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -238,3 +238,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index 404a9ea5c1d..bed0afe8286 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index 658f1161843..a3c4f945351 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 52915d6c143..39c9635cc91 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index 958c04e3d75..f146f03e687 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index ba5e5023a17..c3ab3d5d680 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index e205cae60d1..a0191ba86d7 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 4d650b1c439..8d87c00e1b3 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index 9ee380b0ab9..def94b8795a 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -239,3 +239,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 3906e638ba2..868bb42b6be 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index ffde33c0e1d..fd12a1f3a64 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -239,3 +239,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index fa03d28ee32..dfe3b4a2f92 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -238,3 +238,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index cb5f62302b6..8e9433396fc 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -243,3 +243,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 1b0fbc87241..57314579c63 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -236,3 +236,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index fb948a01083..7a4d17cfdfa 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index 2e7560ed618..d8d9349b56a 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -240,3 +240,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index f4538fefbea..29cc925218f 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1608,7 +1608,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
for (; tables ; tables=tables->next)
{
if (!strcmp(tables->name,table_name) &&
- (!db || !tables->db || !strcmp(db,tables->db)))
+ (!db || !strcmp(db,tables->db)))
{
found_table=1;
Field *find=find_field_in_table(thd,tables->table,name,length,
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 53388220924..4cc9dc550c8 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -73,6 +73,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
}
TABLE_LIST table_list;
bzero((char*) &table_list,sizeof(table_list));
+ table_list.db= table->table_cache_key;
table_list.name=table->table_name;
table_list.table=table;
table_list.grant=table->grant;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 0fb9b77e79e..9c1e017a4f6 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -97,7 +97,7 @@ enum sub_select_type
enum olap_type
{
- NON_EXISTING_ONE, CUBE_TYPE, ROLLUP_TYPE
+ UNSPECIFIED_OLAP_TYPE, CUBE_TYPE, ROLLUP_TYPE
};
/* The state of the lex parsing for selects */
diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc
index d05e891db63..fa4d23805f4 100644
--- a/sql/sql_olap.cc
+++ b/sql/sql_olap.cc
@@ -15,7 +15,18 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/* OLAP implementation by Sinisa Milivojevic <sinisa@mysql.com> */
+/*
+ OLAP implementation by Sinisa Milivojevic <sinisa@mysql.com>
+ Inspired by code submitted by Srilakshmi <lakshmi@gdit.iiit.net>
+
+ The ROLLUP code in this file has to be complitely rewritten as it's
+ not good enough to satisfy the goals of MySQL.
+
+ In 4.1 we will replace this with a working, superior implementation
+ of ROLLUP.
+*/
+
+#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
#ifdef __GNUC__
#pragma implementation // gcc: Class implementation
@@ -179,3 +190,5 @@ int handle_olaps(LEX *lex, SELECT_LEX *select_lex)
sl_return=1; // impossible
return sl_return;
}
+
+#endif /* DISABLED_UNTIL_REWRITTEN_IN_4_1 */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 515886a4b2d..33229b4cb4c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2684,6 +2684,7 @@ mysql_init_query(THD *thd)
thd->lex.select_lex.table_list.next= (byte**) &thd->lex.select_lex.table_list.first;
thd->lex.select_lex.next=0;
thd->lex.olap=0;
+ thd->lex.select->olap= UNSPECIFIED_OLAP_TYPE;
thd->fatal_error=0; // Safety
thd->last_insert_id_used=thd->query_start_used=thd->insert_id_used=0;
thd->sent_row_count=thd->examined_row_count=0;
@@ -2700,7 +2701,7 @@ mysql_init_select(LEX *lex)
select_lex->offset_limit=0;
select_lex->options=0;
select_lex->linkage=UNSPECIFIED_TYPE;
- select_lex->olap= NON_EXISTING_ONE;
+ select_lex->olap= UNSPECIFIED_OLAP_TYPE;
lex->exchange = 0;
lex->proc_list.first=0;
select_lex->order_list.elements=select_lex->group_list.elements=0;
@@ -2767,7 +2768,11 @@ mysql_parse(THD *thd,char *inBuf,uint length)
}
}
else
+ {
+ DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
+ thd->fatal_error));
query_cache_abort(&thd->net);
+ }
thd->proc_info="freeing items";
free_items(thd); /* Free strings used by items */
lex_end(lex);
@@ -3441,3 +3446,28 @@ static bool append_file_to_dir(THD *thd, char **filename_ptr, char *table_name)
strxmov(ptr,buff,table_name,NullS);
return 0;
}
+
+/*
+ Check if the select is a simple select (not an union)
+
+ SYNOPSIS
+ check_simple_select()
+
+ RETURN VALUES
+ 0 ok
+ 1 error ; In this case the error messege is sent to the client
+*/
+
+bool check_simple_select()
+{
+ THD *thd= current_thd;
+ if (thd->lex.select != &thd->lex.select_lex)
+ {
+ char command[80];
+ strmake(command, thd->lex.yylval->symbol.str,
+ min(thd->lex.yylval->symbol.length, sizeof(command)-1));
+ net_printf(&thd->net, ER_CANT_USE_OPTION_HERE, command);
+ return 1;
+ }
+ return 0;
+}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index f9cbab64aad..2f12d7d1012 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -146,7 +146,7 @@ static bool update_sum_func(Item_sum **func);
static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
bool distinct, const char *message=NullS);
static void describe_info(JOIN *join, const char *info);
-extern int handle_olaps(LEX *lex, SELECT_LEX *select);
+
/*
This handles SELECT with and without UNION
*/
@@ -155,23 +155,26 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
{
int res;
register SELECT_LEX *select_lex = &lex->select_lex;
+
+#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
if (lex->olap)
{
- SELECT_LEX *sl, *last_sl;
- int returned;
- for (sl= &lex->select_lex;sl;sl=sl->next)
+ SELECT_LEX *sl, *sl_next;
+ int error;
+ for (sl= &select_lex; sl; sl=sl_next)
{
- if (sl->olap != NON_EXISTING_ONE)
+ sl_next=sl->next; // Save if sl->next changes
+ if (sl->olap != UNSPECIFIED_OLAP_TYPE)
{
- last_sl=sl->next;
- if ((returned=handle_olaps(lex,sl)))
- return returned;
- lex->last_selects->next=sl=last_sl;
- if (!sl) break;
+ if ((error=handle_olaps(lex,sl)))
+ return error;
+ lex->last_selects->next=sl_next;
}
}
lex->select = select_lex;
}
+#endif DISABLED_UNTIL_REWRITTEN_IN_4_1
+
if (select_lex->next)
res=mysql_union(thd,lex,result);
else
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 88d2f7a1d25..aeedfeb148b 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -50,7 +50,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
cursor;
cursor=cursor->next)
{
- if (cursor->do_redirect)
+ if (cursor->do_redirect) // False if CUBE/ROLLUP
{
cursor->table= ((TABLE_LIST*) cursor->table)->table;
cursor->do_redirect=false;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 767a2f67afb..1288f03155e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1435,22 +1435,51 @@ select_option_list:
select_option:
STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; }
- | HIGH_PRIORITY { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_READ_HIGH_PRIORITY; }
+ | HIGH_PRIORITY
+ {
+ if (check_simple_select())
+ YYABORT;
+ Lex->lock_option= TL_READ_HIGH_PRIORITY;
+ }
| DISTINCT { Select->options|= SELECT_DISTINCT; }
| SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
- | SQL_BUFFER_RESULT { if (Select != &Lex->select_lex) YYABORT; Select->options|= OPTION_BUFFER_RESULT; }
- | SQL_CALC_FOUND_ROWS { if (Select != &Lex->select_lex) YYABORT; Select->options|= OPTION_FOUND_ROWS; }
- | SQL_NO_CACHE_SYM { if (Select != &Lex->select_lex) YYABORT; current_thd->safe_to_cache_query=0; }
- | SQL_CACHE_SYM { if (Select != &Lex->select_lex) YYABORT; Select->options |= OPTION_TO_QUERY_CACHE; }
- | ALL {};
+ | SQL_BUFFER_RESULT
+ {
+ if (check_simple_select())
+ YYABORT;
+ Select->options|= OPTION_BUFFER_RESULT;
+ }
+ | SQL_CALC_FOUND_ROWS
+ {
+ if (check_simple_select())
+ YYABORT;
+ Select->options|= OPTION_FOUND_ROWS;
+ }
+ | SQL_NO_CACHE_SYM { current_thd->safe_to_cache_query=0; }
+ | SQL_CACHE_SYM { Select->options|= OPTION_TO_QUERY_CACHE; }
+ | ALL {}
+ ;
select_lock_type:
/* empty */
| FOR_SYM UPDATE_SYM
- { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_WRITE; current_thd->safe_to_cache_query=0; }
+ {
+ LEX *lex=Lex;
+ if (check_simple_select())
+ YYABORT;
+ lex->lock_option= TL_WRITE;
+ lex->thd->safe_to_cache_query=0;
+ }
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
- { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; current_thd->safe_to_cache_query=0; };
+ {
+ LEX *lex=Lex;
+ if (check_simple_select())
+ YYABORT;
+ lex->lock_option= TL_READ_WITH_SHARED_LOCKS;
+ lex->thd->safe_to_cache_query=0;
+ }
+ ;
select_item_list:
select_item_list ',' select_item
@@ -2047,7 +2076,8 @@ join_table:
{
SELECT_LEX *sel=Select;
if (!($$=add_table_to_list($2,$3,0,TL_UNLOCK, sel->use_index_ptr,
- sel->ignore_index_ptr))) YYABORT;
+ sel->ignore_index_ptr)))
+ YYABORT;
}
| '{' ident join_table LEFT OUTER JOIN_SYM join_table ON expr '}'
{ add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; };
@@ -2158,14 +2188,21 @@ olap_opt:
/* empty */ {}
| WITH CUBE_SYM
{
- Lex->olap = true;
- Select->olap= CUBE_TYPE;
+ LEX *lex=Lex;
+ lex->olap = true;
+ lex->select->olap= CUBE_TYPE;
+ net_printf(&lex->thd->net, ER_NOT_SUPPORTED_YET, "CUBE");
+ YYABORT; /* To be deleted in 4.1 */
}
| WITH ROLLUP_SYM
{
- Lex->olap = true;
- Select->olap= ROLLUP_TYPE;
+ LEX *lex=Lex;
+ lex->olap = true;
+ lex->select->olap= ROLLUP_TYPE;
+ net_printf(&lex->thd->net, ER_NOT_SUPPORTED_YET, "ROLLUP");
+ YYABORT; /* To be deleted in 4.1 */
}
+ ;
/*
Order by statement in select
@@ -2180,9 +2217,17 @@ order_clause:
{
LEX *lex=Lex;
if (lex->sql_command == SQLCOM_MULTI_UPDATE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "UPDATE", "ORDER BY");
YYABORT;
- if (lex->olap)
- YYABORT;
+ }
+ if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE,
+ "CUBE/ROLLUP",
+ "ORDER BY");
+ YYABORT;
+ }
lex->select->sort_default=1;
} order_list;
@@ -2203,8 +2248,12 @@ limit_clause:
| LIMIT ULONG_NUM
{
LEX *lex=Lex;
- if (lex->olap)
+ if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "CUBE/ROLLUP",
+ "LIMIT");
YYABORT;
+ }
SELECT_LEX *sel=Select;
sel->select_limit= $2;
sel->offset_limit= 0L;
@@ -2212,9 +2261,13 @@ limit_clause:
| LIMIT ULONG_NUM ',' ULONG_NUM
{
LEX *lex=Lex;
- if (lex->olap)
+ if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "CUBE/ROLLUP",
+ "LIMIT");
YYABORT;
- SELECT_LEX *sel=Select;
+ }
+ SELECT_LEX *sel=lex->select;
sel->select_limit= $4;
sel->offset_limit= $2;
};
@@ -2224,7 +2277,10 @@ delete_limit_clause:
{
LEX *lex=Lex;
if (lex->sql_command == SQLCOM_MULTI_UPDATE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "DELETE", "LIMIT");
YYABORT;
+ }
lex->select->select_limit= HA_POS_ERROR;
}
| LIMIT ulonglong_num
@@ -3475,8 +3531,8 @@ opt_table:
lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements)
{
- send_error(&lex->thd->net,ER_ILLEGAL_GRANT_FOR_TABLE);
- YYABORT;
+ send_error(&lex->thd->net,ER_ILLEGAL_GRANT_FOR_TABLE);
+ YYABORT;
}
}
| ident '.' '*'
@@ -3514,8 +3570,13 @@ opt_table:
user_list:
- grant_user { if (Lex->users_list.push_back($1)) YYABORT;}
- | user_list ',' grant_user { if (Lex->users_list.push_back($3)) YYABORT;};
+ grant_user { if (Lex->users_list.push_back($1)) YYABORT;}
+ | user_list ',' grant_user
+ {
+ if (Lex->users_list.push_back($3))
+ YYABORT;
+ }
+ ;
grant_user:
@@ -3631,42 +3692,55 @@ rollback:
union:
- /* empty */ {}
- | union_list;
+ /* empty */ {}
+ | union_list;
union_list:
- UNION_SYM union_option
- {
- LEX *lex=Lex;
- if (lex->exchange)
- {
- /* Only the last SELECT can have INTO...... */
- net_printf(&lex->thd->net, ER_WRONG_USAGE,"UNION","INTO");
- YYABORT;
- }
- if (lex->select->linkage == NOT_A_SELECT || mysql_new_select(lex))
- YYABORT;
- lex->select->linkage=UNION_TYPE;
- }
- select_init;
+ UNION_SYM union_option
+ {
+ LEX *lex=Lex;
+ if (lex->exchange)
+ {
+ /* Only the last SELECT can have INTO...... */
+ net_printf(&lex->thd->net, ER_WRONG_USAGE,"UNION","INTO");
+ YYABORT;
+ }
+ if (lex->select->linkage == NOT_A_SELECT)
+ {
+ send_error(&lex->thd->net, ER_SYNTAX_ERROR);
+ YYABORT;
+ }
+ if (mysql_new_select(lex))
+ YYABORT;
+ lex->select->linkage=UNION_TYPE;
+ }
+ select_init
+ ;
union_opt:
- union {}
- | optional_order_or_limit {};
+ union {}
+ | optional_order_or_limit {};
optional_order_or_limit:
- /* empty */ {}
- |
- {
- LEX *lex=Lex;
- if (!lex->select->braces || mysql_new_select(lex))
- YYABORT;
- mysql_init_select(lex);
- lex->select->linkage=NOT_A_SELECT;
- lex->select->select_limit=lex->thd->variables.select_limit;
- }
- opt_order_clause limit_clause;
+ /* empty */ {}
+ |
+ {
+ LEX *lex=Lex;
+ if (!lex->select->braces)
+ {
+ send_error(&lex->thd->net, ER_SYNTAX_ERROR);
+ YYABORT;
+ }
+ if (mysql_new_select(lex))
+ YYABORT;
+ mysql_init_select(lex);
+ lex->select->linkage=NOT_A_SELECT;
+ lex->select->select_limit=lex->thd->variables.select_limit;
+ }
+ opt_order_clause limit_clause
+ ;
union_option:
- /* empty */ {}
- | ALL {Lex->union_option=1;};
+ /* empty */ {}
+ | ALL { Lex->union_option=1; }
+ ;