summaryrefslogtreecommitdiff
path: root/sql/item_func.h
diff options
context:
space:
mode:
authorunknown <anozdrin/alik@quad.>2008-02-22 13:30:33 +0300
committerunknown <anozdrin/alik@quad.>2008-02-22 13:30:33 +0300
commita3e83048a36b20481155315d1026c6d91da8ecef (patch)
tree3addb17d5ad1fc4ed36a5cfc04608c6864c99630 /sql/item_func.h
parentffd88cb2bd1bb31a85036a422145b325a36d629e (diff)
downloadmariadb-git-a3e83048a36b20481155315d1026c6d91da8ecef.tar.gz
Fix for Bug#30217: Views: changes in metadata behaviour
between 5.0 and 5.1. The problem was that in the patch for Bug#11986 it was decided to store original query in UTF8 encoding for the INFORMATION_SCHEMA. This approach however turned out to be quite difficult to implement properly. The main problem is to preserve the same IS-output after dump/restore. So, the fix is to rollback to the previous functionality, but also to fix it to support multi-character-set-queries properly. The idea is to generate INFORMATION_SCHEMA-query from the item-tree after parsing view declaration. The IS-query should: - be completely in UTF8; - not contain character set introducers. For more information, see WL4052. mysql-test/include/ddl_i18n.check_views.inc: Add a test case for Bug#30217. mysql-test/r/ddl_i18n_koi8r.result: Update result file. mysql-test/r/ddl_i18n_utf8.result: Update result file. mysql-test/r/information_schema.result: Update result file. mysql-test/r/information_schema_db.result: Update result file. mysql-test/r/mysqldump.result: Update result file. mysql-test/r/show_check.result: Update result file. mysql-test/t/ddl_i18n_koi8r.test: Add a test case for Bug#30217. mysql-test/t/ddl_i18n_utf8.test: Add a test case for Bug#30217. mysql-test/t/mysqldump.test: Add a test case for Bug#30217. sql/ha_ndbcluster.cc: Add a parameter to print(). sql/item.cc: 1. Add a parameter to print(). 2. Item_string::print(): - Do not append character set introducer to the text literal if we're building a query for INFORMATION_SCHEMA; - Convert text literal to UTF8 if we're building a query for INFORMATION_SCHEMA. sql/item.h: Add a parameter to print(). sql/item_cmpfunc.cc: Add a parameter to print(). sql/item_cmpfunc.h: Add a parameter to print(). sql/item_func.cc: Add a parameter to print(). sql/item_func.h: Add a parameter to print(). sql/item_geofunc.h: Add a parameter to print(). sql/item_row.cc: Add a parameter to print(). sql/item_row.h: Add a parameter to print(). sql/item_strfunc.cc: Add a parameter to print(). sql/item_strfunc.h: Add a parameter to print(). sql/item_subselect.cc: Add a parameter to print(). sql/item_subselect.h: Add a parameter to print(). sql/item_sum.cc: Add a parameter to print(). sql/item_sum.h: Add a parameter to print(). sql/item_timefunc.cc: Add a parameter to print(). sql/item_timefunc.h: Add a parameter to print(). sql/mysql_priv.h: Add a parameter to print(). sql/sp_head.cc: Add a parameter to print(). sql/sql_lex.cc: Add a parameter to print(). sql/sql_lex.h: Add a parameter to print(). sql/sql_parse.cc: Add a parameter to print(). sql/sql_select.cc: Add a parameter to print(). sql/sql_show.cc: Add a parameter to print(). sql/sql_test.cc: Add a parameter to print(). sql/sql_view.cc: Build INFORMATION_SCHEMA query from Item-tree. sql/sql_yacc.yy: Build INFORMATION_SCHEMA query from Item-tree. sql/table.h: Add a parameter to print().
Diffstat (limited to 'sql/item_func.h')
-rw-r--r--sql/item_func.h54
1 files changed, 36 insertions, 18 deletions
diff --git a/sql/item_func.h b/sql/item_func.h
index e09b584de95..f8eb7ff6200 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -140,9 +140,9 @@ public:
inline uint argument_count() const { return arg_count; }
inline void remove_arguments() { arg_count=0; }
void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields);
- void print(String *str);
- void print_op(String *str);
- void print_args(String *str, uint from);
+ virtual void print(String *str, enum_query_type query_type);
+ void print_op(String *str, enum_query_type query_type);
+ void print_args(String *str, uint from, enum_query_type query_type);
virtual void fix_num_length_and_dec();
void count_only_length();
void count_real_length();
@@ -293,7 +293,12 @@ class Item_num_op :public Item_func_numhybrid
public:
Item_num_op(Item *a,Item *b) :Item_func_numhybrid(a, b) {}
virtual void result_precision()= 0;
- void print(String *str) { print_op(str); }
+
+ virtual inline void print(String *str, enum_query_type query_type)
+ {
+ print_op(str, query_type);
+ }
+
void find_num_type();
String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
@@ -339,7 +344,7 @@ public:
longlong val_int_from_str(int *error);
void fix_length_and_dec()
{ max_length=args[0]->max_length; unsigned_flag=0; }
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
uint decimal_precision() const { return args[0]->decimal_precision(); }
};
@@ -352,7 +357,7 @@ public:
void fix_length_and_dec()
{ max_length=args[0]->max_length; unsigned_flag=1; }
longlong val_int();
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
};
@@ -373,7 +378,7 @@ public:
enum_field_types field_type() const { return MYSQL_TYPE_NEWDECIMAL; }
void fix_length_and_dec() {};
const char *func_name() const { return "decimal_typecast"; }
- void print(String *);
+ virtual void print(String *str, enum_query_type query_type);
};
@@ -441,7 +446,12 @@ public:
longlong val_int();
const char *func_name() const { return "DIV"; }
void fix_length_and_dec();
- void print(String *str) { print_op(str); }
+
+ virtual inline void print(String *str, enum_query_type query_type)
+ {
+ print_op(str, query_type);
+ }
+
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -843,7 +853,7 @@ public:
const char *func_name() const { return "locate"; }
longlong val_int();
void fix_length_and_dec();
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
};
@@ -900,7 +910,11 @@ public:
Item_func_bit(Item *a, Item *b) :Item_int_func(a, b) {}
Item_func_bit(Item *a) :Item_int_func(a) {}
void fix_length_and_dec() { unsigned_flag= 1; }
- void print(String *str) { print_op(str); }
+
+ virtual inline void print(String *str, enum_query_type query_type)
+ {
+ print_op(str, query_type);
+ }
};
class Item_func_bit_or :public Item_func_bit
@@ -950,7 +964,11 @@ public:
Item_func_bit_neg(Item *a) :Item_func_bit(a) {}
longlong val_int();
const char *func_name() const { return "~"; }
- void print(String *str) { Item_func::print(str); }
+
+ virtual inline void print(String *str, enum_query_type query_type)
+ {
+ Item_func::print(str, query_type);
+ }
};
@@ -979,7 +997,7 @@ public:
longlong val_int();
const char *func_name() const { return "benchmark"; }
void fix_length_and_dec() { max_length=1; maybe_null=0; }
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
};
@@ -1076,7 +1094,7 @@ public:
Item_result result_type () const { return udf.result_type(); }
table_map not_null_tables() const { return 0; }
bool is_expensive() { return 1; }
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
};
@@ -1313,8 +1331,8 @@ public:
enum Item_result result_type () const { return cached_result_type; }
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
- void print(String *str);
- void print_as_stmt(String *str);
+ virtual void print(String *str, enum_query_type query_type);
+ void print_as_stmt(String *str, enum_query_type query_type);
const char *func_name() const { return "set_user_var"; }
int save_in_field(Field *field, bool no_conversions,
bool can_use_result_field);
@@ -1344,7 +1362,7 @@ public:
my_decimal *val_decimal(my_decimal*);
String *val_str(String* str);
void fix_length_and_dec();
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
enum Item_result result_type() const;
/*
We must always return variables as strings to guard against selects of type
@@ -1389,7 +1407,7 @@ public:
my_decimal *val_decimal(my_decimal *decimal_buffer);
/* fix_fields() binds variable name with its entry structure */
bool fix_fields(THD *thd, Item **ref);
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
void set_null_value(CHARSET_INFO* cs);
void set_value(const char *str, uint length, CHARSET_INFO* cs);
};
@@ -1467,7 +1485,7 @@ public:
/* The following should be safe, even if we compare doubles */
longlong val_int() { DBUG_ASSERT(fixed == 1); return val_real() != 0.0; }
double val_real();
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
bool fix_index();
void init_search(bool no_order);