diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/convert.cc | 2 | ||||
-rw-r--r-- | sql/des_key_file.cc | 2 | ||||
-rw-r--r-- | sql/field.cc | 62 | ||||
-rw-r--r-- | sql/field.h | 6 | ||||
-rw-r--r-- | sql/filesort.cc | 2 | ||||
-rw-r--r-- | sql/hostname.cc | 4 | ||||
-rw-r--r-- | sql/item.cc | 12 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 10 | ||||
-rw-r--r-- | sql/item_func.cc | 12 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 6 | ||||
-rw-r--r-- | sql/item_strfunc.h | 6 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 46 | ||||
-rw-r--r-- | sql/log.cc | 2 | ||||
-rw-r--r-- | sql/log_event.cc | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 8 | ||||
-rw-r--r-- | sql/opt_range.cc | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 164 | ||||
-rw-r--r-- | sql/sql_class.cc | 6 | ||||
-rw-r--r-- | sql/sql_help.cc | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 6 | ||||
-rw-r--r-- | sql/sql_string.cc | 12 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 24 | ||||
-rw-r--r-- | sql/time.cc | 40 |
25 files changed, 222 insertions, 222 deletions
diff --git a/sql/convert.cc b/sql/convert.cc index 29abdde7ddc..84003af3922 100644 --- a/sql/convert.cc +++ b/sql/convert.cc @@ -433,7 +433,7 @@ CONVERT *get_convert_set(const char *name) { for (CONVERT **ptr=convert_tables ; *ptr ; ptr++) { - if (!my_strcasecmp(my_charset_latin1,(*ptr)->name,name)) + if (!my_strcasecmp(&my_charset_latin1,(*ptr)->name,name)) return (*ptr); } return 0; diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc index 22cf9094486..aa74a7880db 100644 --- a/sql/des_key_file.cc +++ b/sql/des_key_file.cc @@ -34,7 +34,7 @@ static int initialized; 1 Error */ -#define des_cs my_charset_latin1 +#define des_cs &my_charset_latin1 bool load_des_key_file(const char *file_name) diff --git a/sql/field.cc b/sql/field.cc index 93ae5b81409..89ca6ff96c2 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -287,7 +287,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy) bool Field::get_date(TIME *ltime,bool fuzzydate) { char buff[40]; - String tmp(buff,sizeof(buff),my_charset_bin),tmp2,*res; + String tmp(buff,sizeof(buff),&my_charset_bin),tmp2,*res; if (!(res=val_str(&tmp,&tmp2)) || str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE) return 1; @@ -297,7 +297,7 @@ bool Field::get_date(TIME *ltime,bool fuzzydate) bool Field::get_time(TIME *ltime) { char buff[40]; - String tmp(buff,sizeof(buff),my_charset_bin),tmp2,*res; + String tmp(buff,sizeof(buff),&my_charset_bin),tmp2,*res; if (!(res=val_str(&tmp,&tmp2)) || str_to_time(res->ptr(),res->length(),ltime)) return 1; @@ -311,23 +311,23 @@ void Field::store_time(TIME *ltime,timestamp_type type) char buff[25]; switch (type) { case TIMESTAMP_NONE: - store("",0,my_charset_bin); // Probably an error + store("",0,&my_charset_bin); // Probably an error break; case TIMESTAMP_DATE: sprintf(buff,"%04d-%02d-%02d", ltime->year,ltime->month,ltime->day); - store(buff,10,my_charset_bin); + store(buff,10,&my_charset_bin); break; case TIMESTAMP_FULL: sprintf(buff,"%04d-%02d-%02d %02d:%02d:%02d", ltime->year,ltime->month,ltime->day, ltime->hour,ltime->minute,ltime->second); - store(buff,19,my_charset_bin); + store(buff,19,&my_charset_bin); break; case TIMESTAMP_TIME: { ulong length= my_sprintf(buff, (buff, "%02d:%02d:%02d", ltime->hour,ltime->minute,ltime->second)); - store(buff,(uint) length, my_charset_bin); + store(buff,(uint) length, &my_charset_bin); break; } } @@ -357,7 +357,7 @@ void Field_null::sql_type(String &res) const void Field_decimal::reset(void) { - Field_decimal::store("0",1,my_charset_bin); + Field_decimal::store("0",1,&my_charset_bin); } void Field_decimal::overflow(bool negative) @@ -402,12 +402,12 @@ void Field_decimal::overflow(bool negative) int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) { char buff[80]; - String tmp(buff,sizeof(buff), my_charset_bin); + String tmp(buff,sizeof(buff), &my_charset_bin); /* Convert character set if the old one is multi byte */ if (cs->mbmaxlen > 1) { - tmp.copy(from, len, cs, my_charset_bin); + tmp.copy(from, len, cs, &my_charset_bin); from= tmp.ptr(); len= tmp.length(); } @@ -471,7 +471,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) tmp_dec++; /* skip pre-space */ - while (from != end && my_isspace(my_charset_bin,*from)) + while (from != end && my_isspace(&my_charset_bin,*from)) from++; if (from == end) { @@ -508,13 +508,13 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) for (; from!=end && *from == '0'; from++) ; // Read prezeros pre_zeros_end=int_digits_from=from; /* Read non zero digits at the left of '.'*/ - for (; from != end && my_isdigit(my_charset_bin, *from) ; from++) ; + for (; from != end && my_isdigit(&my_charset_bin, *from) ; from++) ; int_digits_end=from; if (from!=end && *from == '.') // Some '.' ? from++; frac_digits_from= from; /* Read digits at the right of '.' */ - for (;from!=end && my_isdigit(my_charset_bin, *from); from++) ; + for (;from!=end && my_isdigit(&my_charset_bin, *from); from++) ; frac_digits_end=from; // Some exponentiation symbol ? if (from != end && (*from == 'e' || *from == 'E')) @@ -530,7 +530,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) exponents will become small (e.g. 1e4294967296 will become 1e0, and the field will finally contain 1 instead of its max possible value). */ - for (;from!=end && my_isdigit(my_charset_bin, *from); from++) + for (;from!=end && my_isdigit(&my_charset_bin, *from); from++) { exponent=10*exponent+(*from-'0'); if (exponent>MAX_EXPONENT) @@ -548,7 +548,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) if (current_thd->count_cuted_fields) { // Skip end spaces - for (;from != end && my_isspace(my_charset_bin, *from); from++) ; + for (;from != end && my_isspace(&my_charset_bin, *from); from++) ; if (from != end) // If still something left, warn { current_thd->cuted_fields++; @@ -841,17 +841,17 @@ int Field_decimal::store(longlong nr) double Field_decimal::val_real(void) { int not_used; - return my_strntod(my_charset_bin, ptr, field_length, NULL, ¬_used); + return my_strntod(&my_charset_bin, ptr, field_length, NULL, ¬_used); } longlong Field_decimal::val_int(void) { int not_used; if (unsigned_flag) - return my_strntoull(my_charset_bin, ptr, field_length, 10, NULL, + return my_strntoull(&my_charset_bin, ptr, field_length, 10, NULL, ¬_used); else - return my_strntoll( my_charset_bin, ptr, field_length, 10, NULL, + return my_strntoll(&my_charset_bin, ptr, field_length, 10, NULL, ¬_used); } @@ -862,7 +862,7 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)), char *str; for (str=ptr ; *str == ' ' ; str++) ; uint tmp_length=(uint) (str-ptr); - val_ptr->set_charset(my_charset_bin); + val_ptr->set_charset(&my_charset_bin); if (field_length < tmp_length) // Error in data val_ptr->length(0); else @@ -883,9 +883,9 @@ int Field_decimal::cmp(const char *a_ptr,const char *b_ptr) for (end=a_ptr+field_length; a_ptr != end && (*a_ptr == *b_ptr || - ((my_isspace(my_charset_bin,*a_ptr) || *a_ptr == '+' || + ((my_isspace(&my_charset_bin,*a_ptr) || *a_ptr == '+' || *a_ptr == '0') && - (my_isspace(my_charset_bin,*b_ptr) || *b_ptr == '+' || + (my_isspace(&my_charset_bin,*b_ptr) || *b_ptr == '+' || *b_ptr == '0'))); a_ptr++,b_ptr++) { @@ -913,7 +913,7 @@ void Field_decimal::sort_string(char *to,uint length) char *str,*end; for (str=ptr,end=ptr+length; str != end && - ((my_isspace(my_charset_bin,*str) || *str == '+' || + ((my_isspace(&my_charset_bin,*str) || *str == '+' || *str == '0')) ; str++) *to++=' '; @@ -925,7 +925,7 @@ void Field_decimal::sort_string(char *to,uint length) *to++=1; // Smaller than any number str++; while (str != end) - if (my_isdigit(my_charset_bin,*str)) + if (my_isdigit(&my_charset_bin,*str)) *to++= (char) ('9' - *str++); else *to++= *str++; @@ -1103,7 +1103,7 @@ longlong Field_tiny::val_int(void) String *Field_tiny::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs= my_charset_bin; + CHARSET_INFO *cs= &my_charset_bin; uint length; uint mlength=max(field_length+1,5*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1341,7 +1341,7 @@ longlong Field_short::val_int(void) String *Field_short::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs= my_charset_bin; + CHARSET_INFO *cs= &my_charset_bin; uint length; uint mlength=max(field_length+1,7*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1586,7 +1586,7 @@ longlong Field_medium::val_int(void) String *Field_medium::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs= my_charset_bin; + CHARSET_INFO *cs= &my_charset_bin; uint length; uint mlength=max(field_length+1,10*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1816,7 +1816,7 @@ longlong Field_long::val_int(void) String *Field_long::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs= my_charset_bin; + CHARSET_INFO *cs= &my_charset_bin; uint length; uint mlength=max(field_length+1,12*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -2038,7 +2038,7 @@ longlong Field_longlong::val_int(void) String *Field_longlong::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs= my_charset_bin; + CHARSET_INFO *cs= &my_charset_bin; uint length; uint mlength=max(field_length+1,22*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -2844,10 +2844,10 @@ String *Field_timestamp::val_str(String *val_buffer, if (temp == 0L) { /* Zero time is "000000" */ - val_ptr->set("0000-00-00 00:00:00", 19, my_charset_bin); + val_ptr->set("0000-00-00 00:00:00", 19, &my_charset_bin); return val_ptr; } - val_buffer->set_charset(my_charset_bin); // Safety + val_buffer->set_charset(&my_charset_bin); // Safety time_arg=(time_t) temp; localtime_r(&time_arg,&tm_tmp); l_time=&tm_tmp; @@ -3907,7 +3907,7 @@ int Field_string::store(double nr) int width=min(field_length,DBL_DIG+5); sprintf(buff,"%-*.*g",width,max(width-5,0),nr); end=strcend(buff,' '); - return Field_string::store(buff,(uint) (end - buff), my_charset_bin); + return Field_string::store(buff,(uint) (end - buff), &my_charset_bin); } @@ -4067,7 +4067,7 @@ int Field_varstring::store(double nr) int width=min(field_length,DBL_DIG+5); sprintf(buff,"%-*.*g",width,max(width-5,0),nr); end=strcend(buff,' '); - return Field_varstring::store(buff,(uint) (end - buff), my_charset_bin); + return Field_varstring::store(buff,(uint) (end - buff), &my_charset_bin); } diff --git a/sql/field.h b/sql/field.h index f184c145b6e..f13ef2ee735 100644 --- a/sql/field.h +++ b/sql/field.h @@ -205,7 +205,7 @@ public: uint fill_cache_field(struct st_cache_field *copy); virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_time(TIME *ltime); - virtual CHARSET_INFO *charset(void) const { return my_charset_bin; } + virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; } virtual void set_charset(CHARSET_INFO *charset) { } friend bool reopen_table(THD *,struct st_table *,bool); friend int cre_myisam(my_string name, register TABLE *form, uint options, @@ -943,11 +943,11 @@ public: enum utype unireg_check_arg, const char *field_name_arg, struct st_table *table_arg,uint blob_pack_length) :Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, table_arg, blob_pack_length,my_charset_bin) {} + field_name_arg, table_arg, blob_pack_length,&my_charset_bin) {} Field_geom(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, struct st_table *table_arg) :Field_blob(len_arg, maybe_null_arg, field_name_arg, - table_arg, my_charset_bin) {} + table_arg, &my_charset_bin) {} enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY; } enum_field_types type() const { return FIELD_TYPE_GEOMETRY;} void sql_type(String &str) const; diff --git a/sql/filesort.cc b/sql/filesort.cc index 0e0b2c8f33a..6d2932946e4 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -75,7 +75,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, uchar **sort_keys; IO_CACHE tempfile, buffpek_pointers, *selected_records_file, *outfile; SORTPARAM param; - CHARSET_INFO *charset=my_charset_bin; + CHARSET_INFO *charset= &my_charset_bin; DBUG_ENTER("filesort"); DBUG_EXECUTE("info",TEST_filesort(sortorder,s_length);); #ifdef SKIP_DBUG_IN_FILESORT diff --git a/sql/hostname.cc b/sql/hostname.cc index 0c86c3305b7..0124fa6d060 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -221,10 +221,10 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) /* Don't accept hostnames that starts with digits because they may be false ip:s */ - if (my_isdigit(my_charset_latin1,name[0])) + if (my_isdigit(&my_charset_latin1,name[0])) { char *pos; - for (pos= name+1 ; my_isdigit(my_charset_latin1,*pos); pos++) ; + for (pos= name+1 ; my_isdigit(&my_charset_latin1,*pos); pos++) ; if (*pos == '.') { DBUG_PRINT("error",("mysqld doesn't accept hostnames that starts with a number followed by a '.'")); diff --git a/sql/item.cc b/sql/item.cc index 575c5b4d89c..ad35d36b0fd 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -115,7 +115,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const bool Item::get_date(TIME *ltime,bool fuzzydate) { char buff[40]; - String tmp(buff,sizeof(buff), my_charset_bin),*res; + String tmp(buff,sizeof(buff), &my_charset_bin),*res; if (!(res=val_str(&tmp)) || str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE) { @@ -133,7 +133,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate) bool Item::get_time(TIME *ltime) { char buff[40]; - String tmp(buff,sizeof(buff),my_charset_bin),*res; + String tmp(buff,sizeof(buff),&my_charset_bin),*res; if (!(res=val_str(&tmp)) || str_to_time(res->ptr(),res->length(),ltime)) { @@ -883,7 +883,7 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length) char *ptr=(char*) sql_alloc(max_length+1); if (!ptr) return; - str_value.set(ptr,max_length,my_charset_bin); + str_value.set(ptr,max_length,&my_charset_bin); char *end=ptr+max_length; if (max_length*2 != str_length) *ptr++=char_val(*str++); // Not even, assume 0 prefix @@ -1232,7 +1232,7 @@ Item *resolve_const_item(Item *item,Item *comp_item) if (res_type == STRING_RESULT) { char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff),my_charset_bin),*result; + String tmp(buff,sizeof(buff),&my_charset_bin),*result; result=item->val_str(&tmp); if (item->null_value) { @@ -1287,8 +1287,8 @@ bool field_is_equal_to_item(Field *field,Item *item) { char item_buff[MAX_FIELD_WIDTH]; char field_buff[MAX_FIELD_WIDTH]; - String item_tmp(item_buff,sizeof(item_buff),my_charset_bin),*item_result; - String field_tmp(field_buff,sizeof(field_buff),my_charset_bin); + String item_tmp(item_buff,sizeof(item_buff),&my_charset_bin),*item_result; + String field_tmp(field_buff,sizeof(field_buff),&my_charset_bin); item_result=item->val_str(&item_tmp); if (item->null_value) return 1; // This must be true diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 06b7dc451dc..94894fdb918 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -282,7 +282,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, if (args[0]->maybe_null) maybe_null=1; if (args[0]->binary()) - set_charset(my_charset_bin); + set_charset(&my_charset_bin); with_sum_func= args[0]->with_sum_func; used_tables_cache= args[0]->used_tables(); const_item_cache= args[0]->const_item(); @@ -648,11 +648,11 @@ Item_func_if::fix_length_and_dec() { cached_result_type = STRING_RESULT; set_charset( (args[1]->binary() || args[2]->binary()) ? - my_charset_bin : args[1]->charset()); + &my_charset_bin : args[1]->charset()); } else { - set_charset(my_charset_bin); // Number + set_charset(&my_charset_bin); // Number if (arg1_type == REAL_RESULT || arg2_type == REAL_RESULT) cached_result_type = REAL_RESULT; else @@ -1680,7 +1680,7 @@ longlong Item_func_like::val_int() null_value=0; if ((res->charset()->state & MY_CS_BINSORT) || (res2->charset()->state & MY_CS_BINSORT)) - set_charset(my_charset_bin); + set_charset(&my_charset_bin); if (canDoTurboBM) return turboBM_matches(res->ptr(), res->length()) ? 1 : 0; return my_wildcmp(charset(), @@ -1767,7 +1767,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) max_length= 1; decimals= 0; if (args[0]->binary() || args[1]->binary()) - set_charset(my_charset_bin); + set_charset(&my_charset_bin); used_tables_cache=args[0]->used_tables() | args[1]->used_tables(); const_item_cache=args[0]->const_item() && args[1]->const_item(); diff --git a/sql/item_func.cc b/sql/item_func.cc index 477b759be61..112af20f14e 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -115,7 +115,7 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) if ((*arg)->maybe_null) maybe_null=1; if ((*arg)->binary()) - set_charset(my_charset_bin); + set_charset(&my_charset_bin); with_sum_func= with_sum_func || (*arg)->with_sum_func; used_tables_cache|=(*arg)->used_tables(); const_item_cache&= (*arg)->const_item(); @@ -856,7 +856,7 @@ void Item_func_min_max::fix_length_and_dec() maybe_null=0; cmp_type=item_cmp_type(cmp_type,args[i]->result_type()); if (args[i]->binary()) - set_charset(my_charset_bin); + set_charset(&my_charset_bin); } } @@ -1325,7 +1325,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func, if ((*arg)->fix_fields(thd, tables, arg) || (*arg)->check_cols(1)) return 1; if ((*arg)->binary()) - func->set_charset(my_charset_bin); + func->set_charset(&my_charset_bin); if ((*arg)->maybe_null) func->maybe_null=1; func->with_sum_func= func->with_sum_func || (*arg)->with_sum_func; @@ -1894,7 +1894,7 @@ longlong Item_func_set_last_insert_id::val_int() longlong Item_func_benchmark::val_int() { char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff), my_charset_bin); + String tmp(buff,sizeof(buff), &my_charset_bin); THD *thd=current_thd; for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++) @@ -2040,7 +2040,7 @@ Item_func_set_user_var::update() case STRING_RESULT: { char buffer[MAX_FIELD_WIDTH]; - String tmp(buffer,sizeof(buffer),my_charset_bin); + String tmp(buffer,sizeof(buffer),&my_charset_bin); (void) val_str(&tmp); break; } @@ -2235,7 +2235,7 @@ longlong Item_func_inet_aton::val_int() char c = '.'; // we mark c to indicate invalid IP in case length is 0 char buff[36]; - String *s,tmp(buff,sizeof(buff),my_charset_bin); + String *s,tmp(buff,sizeof(buff),&my_charset_bin); if (!(s = args[0]->val_str(&tmp))) // If null value goto err; null_value=0; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 03dd940db51..21d28048848 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -236,7 +236,7 @@ String *Item_func_concat::val_str(String *str) for (i=1 ; i < arg_count ; i++) { if (args[i]->binary()) - set_charset(my_charset_bin); + set_charset(&my_charset_bin); if (res->length() == 0) { if (!(res=args[i]->val_str(str))) @@ -1490,7 +1490,7 @@ String *Item_func_soundex::val_str(String *str) { String *res =args[0]->val_str(str); char last_ch,ch; - CHARSET_INFO *cs=my_charset_latin1; + CHARSET_INFO *cs= &my_charset_latin1; if ((null_value=args[0]->null_value)) return 0; /* purecov: inspected */ @@ -2204,7 +2204,7 @@ String *Item_func_charset::val_str(String *str) if ((null_value=(args[0]->null_value || !res->charset()))) return 0; str->copy(res->charset()->name,strlen(res->charset()->name), - my_charset_latin1, thd_charset()); + &my_charset_latin1, thd_charset()); return str; } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 339a49a3580..68675eafc52 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -526,12 +526,12 @@ public: { String *tmp=args[0]->val_str(a); null_value=args[0]->null_value; - tmp->set_charset(my_charset_bin); + tmp->set_charset(&my_charset_bin); return tmp; } void fix_length_and_dec() { - set_charset(my_charset_bin); + set_charset(&my_charset_bin); max_length=args[0]->max_length; } void print(String *str) { print_op(str); } @@ -547,7 +547,7 @@ public: const char *func_name() const { return "load_file"; } void fix_length_and_dec() { - set_charset(my_charset_bin); + set_charset(&my_charset_bin); maybe_null=1; max_length=MAX_BLOB_WIDTH; } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 744c0c1fa49..a032e25cec8 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -31,28 +31,28 @@ static String month_names[] = { - String("January", my_charset_latin1), - String("February", my_charset_latin1), - String("March", my_charset_latin1), - String("April", my_charset_latin1), - String("May", my_charset_latin1), - String("June", my_charset_latin1), - String("July", my_charset_latin1), - String("August", my_charset_latin1), - String("September", my_charset_latin1), - String("October", my_charset_latin1), - String("November", my_charset_latin1), - String("December", my_charset_latin1) + String("January", &my_charset_latin1), + String("February", &my_charset_latin1), + String("March", &my_charset_latin1), + String("April", &my_charset_latin1), + String("May", &my_charset_latin1), + String("June", &my_charset_latin1), + String("July", &my_charset_latin1), + String("August", &my_charset_latin1), + String("September", &my_charset_latin1), + String("October", &my_charset_latin1), + String("November", &my_charset_latin1), + String("December", &my_charset_latin1) }; static String day_names[] = { - String("Monday", my_charset_latin1), - String("Tuesday", my_charset_latin1), - String("Wednesday", my_charset_latin1), - String("Thursday", my_charset_latin1), - String("Friday", my_charset_latin1), - String("Saturday", my_charset_latin1), - String("Sunday", my_charset_latin1) + String("Monday", &my_charset_latin1), + String("Tuesday", &my_charset_latin1), + String("Wednesday", &my_charset_latin1), + String("Thursday", &my_charset_latin1), + String("Friday", &my_charset_latin1), + String("Saturday", &my_charset_latin1), + String("Sunday", &my_charset_latin1) }; /* @@ -416,7 +416,7 @@ String *Item_date::val_str(String *str) return (String*) 0; if (!value) // zero daynr { - str->copy("0000-00-00",10,my_charset_latin1,thd_charset()); + str->copy("0000-00-00",10,&my_charset_latin1,thd_charset()); return str; } @@ -425,7 +425,7 @@ String *Item_date::val_str(String *str) (int) (value/10000L) % 10000, (int) (value/100)%100, (int) (value%100)); - str->copy(tmpbuff,10,my_charset_latin1,thd_charset()); + str->copy(tmpbuff,10,&my_charset_latin1,thd_charset()); return str; } @@ -529,7 +529,7 @@ void Item_func_now::fix_length_and_dec() { struct tm tm_tmp,*start; time_t query_start=current_thd->query_start(); - CHARSET_INFO *cs=my_charset_bin; + CHARSET_INFO *cs= &my_charset_bin; decimals=0; max_length=19*cs->mbmaxlen; @@ -595,7 +595,7 @@ String *Item_func_sec_to_time::val_str(String *str) uint sec= (uint) ((ulonglong) seconds % 3600); length= my_sprintf(buff,(buff,"%s%02lu:%02u:%02u",sign,(long) (seconds/3600), sec/60, sec % 60)); - str->copy(buff, length, my_charset_latin1, thd_charset()); + str->copy(buff, length, &my_charset_latin1, thd_charset()); return str; } diff --git a/sql/log.cc b/sql/log.cc index b0e904969e7..0c06ae551aa 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -30,7 +30,7 @@ #include <stdarg.h> #include <m_ctype.h> // For test_if_number -#define files_charset_info my_charset_latin1 +#define files_charset_info &my_charset_latin1 MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log; extern I_List<i_string> binlog_do_db, binlog_ignore_db; diff --git a/sql/log_event.cc b/sql/log_event.cc index 509e62ba03b..a46b95507c8 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -24,7 +24,7 @@ #include <my_dir.h> #endif /* MYSQL_CLIENT */ -#define log_cs my_charset_latin1 +#define log_cs &my_charset_latin1 /***************************************************************************** diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5256142ed64..86d07207c51 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -33,7 +33,7 @@ #include <thr_alarm.h> #include <ft_global.h> -#define mysqld_charset my_charset_latin1 +#define mysqld_charset &my_charset_latin1 #ifndef DBUG_OFF #define ONE_THREAD @@ -1937,7 +1937,7 @@ static int init_common_variables(const char *conf_file_name, int argc, set_var_init(); mysys_uses_curses=0; #ifdef USE_REGEX - regex_init(my_charset_latin1); + regex_init(&my_charset_latin1); #endif if (set_default_charset_by_name(sys_charset.value, MYF(MY_WME))) return 1; @@ -4736,8 +4736,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), int err; char *end; uint length= strlen(argument); - long value= my_strntol(my_charset_latin1, argument, length, 10, &end, &err); - if (test_if_int(argument,(uint) length, end, my_charset_latin1)) + long value= my_strntol(&my_charset_latin1, argument, length, 10, &end, &err); + if (test_if_int(argument,(uint) length, end, &my_charset_latin1)) berkeley_lock_scan_time= value; else { diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 33309d35157..980390f04bf 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2794,7 +2794,7 @@ static void print_key(KEY_PART *key_part,const char *key,uint used_length) { char buff[1024]; - String tmp(buff,sizeof(buff),my_charset_bin); + String tmp(buff,sizeof(buff),&my_charset_bin); for (uint length=0; length < used_length ; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 645d0439961..3dc370b7b63 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -397,7 +397,7 @@ static ulong get_access(TABLE *form, uint fieldnr) { ulong access_bits=0,bit; char buff[2]; - String res(buff,sizeof(buff),my_charset_latin1); + String res(buff,sizeof(buff),&my_charset_latin1); Field **pos; for (pos=form->field+fieldnr, bit=1; @@ -406,7 +406,7 @@ static ulong get_access(TABLE *form, uint fieldnr) pos++ , bit<<=1) { (*pos)->val_str(&res,&res); - if (my_toupper(my_charset_latin1, res[0]) == 'Y') + if (my_toupper(&my_charset_latin1, res[0]) == 'Y') access_bits|= bit; } return access_bits; @@ -706,7 +706,7 @@ static void acl_update_user(const char *user, const char *host, { if (!acl_user->host.hostname && !host[0] || acl_user->host.hostname && - !my_strcasecmp(my_charset_latin1, host, acl_user->host.hostname)) + !my_strcasecmp(&my_charset_latin1, host, acl_user->host.hostname)) { acl_user->access=privileges; if (mqh->bits & 1) @@ -801,7 +801,7 @@ static void acl_update_db(const char *user, const char *host, const char *db, { if (!acl_db->host.hostname && !host[0] || acl_db->host.hostname && - !my_strcasecmp(my_charset_latin1, host, acl_db->host.hostname)) + !my_strcasecmp(&my_charset_latin1, host, acl_db->host.hostname)) { if (!acl_db->db && !db[0] || acl_db->db && !strcmp(db,acl_db->db)) @@ -865,7 +865,7 @@ ulong acl_get(const char *host, const char *ip, const char *bin_ip, end=strmov((tmp_db=strmov(key+sizeof(struct in_addr),user)+1),db); if (lower_case_table_names) { - my_casedn_str(my_charset_latin1, tmp_db); + my_casedn_str(&my_charset_latin1, tmp_db); db=tmp_db; } key_length=(uint) (end-key); @@ -983,7 +983,7 @@ static void init_check_host(void) DBUG_ENTER("init_check_host"); VOID(my_init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip), acl_users.elements,1)); - VOID(hash_init(&acl_check_hosts,my_charset_latin1,acl_users.elements,0,0, + VOID(hash_init(&acl_check_hosts,&my_charset_latin1,acl_users.elements,0,0, (hash_get_key) check_get_key,0,HASH_CASE_INSENSITIVE)); if (!allow_all_hosts) { @@ -999,7 +999,7 @@ static void init_check_host(void) { // Check if host already exists acl_host_and_ip *acl=dynamic_element(&acl_wild_hosts,j, acl_host_and_ip *); - if (!my_strcasecmp(my_charset_latin1, + if (!my_strcasecmp(&my_charset_latin1, acl_user->host.hostname, acl->hostname)) break; // already stored } @@ -1078,7 +1078,7 @@ bool check_change_password(THD *thd, const char *host, const char *user) } if (!thd->slave_thread && (strcmp(thd->user,user) || - my_strcasecmp(my_charset_latin1, host, thd->host_or_ip))) + my_strcasecmp(&my_charset_latin1, host, thd->host_or_ip))) { if (check_access(thd, UPDATE_ACL, "mysql",0,1)) return(1); @@ -1242,7 +1242,7 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname, return (tmp & host->ip_mask) == host->ip; } return (!host->hostname || - (hostname && !wild_case_compare(my_charset_latin1, + (hostname && !wild_case_compare(&my_charset_latin1, hostname,host->hostname)) || (ip && !wild_compare(ip,host->hostname))); } @@ -1266,8 +1266,8 @@ static bool update_user_table(THD *thd, const char *host, const char *user, tables.db=(char*) "mysql"; if (!(table=open_ltable(thd,&tables,TL_WRITE))) DBUG_RETURN(1); /* purecov: deadcode */ - table->field[0]->store(host,(uint) strlen(host), my_charset_latin1); - table->field[1]->store(user,(uint) strlen(user), my_charset_latin1); + table->field[0]->store(host,(uint) strlen(host), &my_charset_latin1); + table->field[1]->store(user,(uint) strlen(user), &my_charset_latin1); if (table->file->index_read_idx(table->record[0],0, (byte*) table->field[0]->ptr,0, @@ -1277,7 +1277,7 @@ static bool update_user_table(THD *thd, const char *host, const char *user, DBUG_RETURN(1); /* purecov: deadcode */ } store_record(table,1); - table->field[2]->store(new_password,(uint) strlen(new_password), my_charset_latin1); + table->field[2]->store(new_password,(uint) strlen(new_password), &my_charset_latin1); if ((error=table->file->update_row(table->record[1],table->record[0]))) { table->file->print_error(error,MYF(0)); /* purecov: deadcode */ @@ -1344,8 +1344,8 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, password=combo.password.str; } - table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1); - table->field[1]->store(combo.user.str,combo.user.length, my_charset_latin1); + table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1); + table->field[1]->store(combo.user.str,combo.user.length, &my_charset_latin1); table->file->index_init(0); if (table->file->index_read(table->record[0], (byte*) table->field[0]->ptr,0, @@ -1366,16 +1366,16 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, } old_row_exists = 0; restore_record(table,2); // cp empty row from record[2] - table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1); - table->field[1]->store(combo.user.str,combo.user.length, my_charset_latin1); - table->field[2]->store(password,(uint) strlen(password), my_charset_latin1); + table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1); + table->field[1]->store(combo.user.str,combo.user.length, &my_charset_latin1); + table->field[2]->store(password,(uint) strlen(password), &my_charset_latin1); } else { old_row_exists = 1; store_record(table,1); // Save copy for update if (combo.password.str) // If password given - table->field[2]->store(password,(uint) strlen(password), my_charset_latin1); + table->field[2]->store(password,(uint) strlen(password), &my_charset_latin1); } /* Update table columns with new privileges */ @@ -1388,7 +1388,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, tmp_field++, priv <<= 1) { if (priv & rights) // set requested privileges - (*tmp_field)->store(&what, 1, my_charset_latin1); + (*tmp_field)->store(&what, 1, &my_charset_latin1); } rights=get_access(table,3); DBUG_PRINT("info",("table->fields: %d",table->fields)); @@ -1397,39 +1397,39 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, /* We write down SSL related ACL stuff */ switch (thd->lex.ssl_type) { case SSL_TYPE_ANY: - table->field[24]->store("ANY",3, my_charset_latin1); - table->field[25]->store("", 0, my_charset_latin1); - table->field[26]->store("", 0, my_charset_latin1); - table->field[27]->store("", 0, my_charset_latin1); + table->field[24]->store("ANY",3, &my_charset_latin1); + table->field[25]->store("", 0, &my_charset_latin1); + table->field[26]->store("", 0, &my_charset_latin1); + table->field[27]->store("", 0, &my_charset_latin1); break; case SSL_TYPE_X509: - table->field[24]->store("X509",4, my_charset_latin1); - table->field[25]->store("", 0, my_charset_latin1); - table->field[26]->store("", 0, my_charset_latin1); - table->field[27]->store("", 0, my_charset_latin1); + table->field[24]->store("X509",4, &my_charset_latin1); + table->field[25]->store("", 0, &my_charset_latin1); + table->field[26]->store("", 0, &my_charset_latin1); + table->field[27]->store("", 0, &my_charset_latin1); break; case SSL_TYPE_SPECIFIED: - table->field[24]->store("SPECIFIED",9, my_charset_latin1); - table->field[25]->store("", 0, my_charset_latin1); - table->field[26]->store("", 0, my_charset_latin1); - table->field[27]->store("", 0, my_charset_latin1); + table->field[24]->store("SPECIFIED",9, &my_charset_latin1); + table->field[25]->store("", 0, &my_charset_latin1); + table->field[26]->store("", 0, &my_charset_latin1); + table->field[27]->store("", 0, &my_charset_latin1); if (thd->lex.ssl_cipher) table->field[25]->store(thd->lex.ssl_cipher, - strlen(thd->lex.ssl_cipher), my_charset_latin1); + strlen(thd->lex.ssl_cipher), &my_charset_latin1); if (thd->lex.x509_issuer) table->field[26]->store(thd->lex.x509_issuer, - strlen(thd->lex.x509_issuer), my_charset_latin1); + strlen(thd->lex.x509_issuer), &my_charset_latin1); if (thd->lex.x509_subject) table->field[27]->store(thd->lex.x509_subject, - strlen(thd->lex.x509_subject), my_charset_latin1); + strlen(thd->lex.x509_subject), &my_charset_latin1); break; case SSL_TYPE_NOT_SPECIFIED: break; case SSL_TYPE_NONE: - table->field[24]->store("", 0, my_charset_latin1); - table->field[25]->store("", 0, my_charset_latin1); - table->field[26]->store("", 0, my_charset_latin1); - table->field[27]->store("", 0, my_charset_latin1); + table->field[24]->store("", 0, &my_charset_latin1); + table->field[25]->store("", 0, &my_charset_latin1); + table->field[26]->store("", 0, &my_charset_latin1); + table->field[27]->store("", 0, &my_charset_latin1); break; } @@ -1518,9 +1518,9 @@ static int replace_db_table(TABLE *table, const char *db, DBUG_RETURN(-1); } - table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1); - table->field[1]->store(db,(uint) strlen(db), my_charset_latin1); - table->field[2]->store(combo.user.str,combo.user.length, my_charset_latin1); + table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1); + table->field[1]->store(db,(uint) strlen(db), &my_charset_latin1); + table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1); table->file->index_init(0); if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr,0, HA_READ_KEY_EXACT)) @@ -1533,9 +1533,9 @@ static int replace_db_table(TABLE *table, const char *db, } old_row_exists = 0; restore_record(table,2); // cp empty row from record[2] - table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1); - table->field[1]->store(db,(uint) strlen(db), my_charset_latin1); - table->field[2]->store(combo.user.str,combo.user.length, my_charset_latin1); + table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1); + table->field[1]->store(db,(uint) strlen(db), &my_charset_latin1); + table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1); } else { @@ -1547,7 +1547,7 @@ static int replace_db_table(TABLE *table, const char *db, for (i= 3, priv= 1; i < table->fields; i++, priv <<= 1) { if (priv & store_rights) // do it if priv is chosen - table->field [i]->store(&what,1, my_charset_latin1);// set requested privileges + table->field [i]->store(&what,1, &my_charset_latin1);// set requested privileges } rights=get_access(table,3); rights=fix_rights_for_db(rights); @@ -1628,13 +1628,13 @@ public: tname= strdup_root(&memex,t); if (lower_case_table_names) { - my_casedn_str(my_charset_latin1, db); - my_casedn_str(my_charset_latin1, tname); + my_casedn_str(&my_charset_latin1, db); + my_casedn_str(&my_charset_latin1, tname); } key_length =(uint) strlen(d)+(uint) strlen(u)+(uint) strlen(t)+3; hash_key = (char*) alloc_root(&memex,key_length); strmov(strmov(strmov(hash_key,user)+1,db)+1,tname); - (void) hash_init(&hash_columns,my_charset_latin1, + (void) hash_init(&hash_columns,&my_charset_latin1, 0,0,0, (hash_get_key) get_key_column,0, HASH_CASE_INSENSITIVE); } @@ -1657,8 +1657,8 @@ public: } if (lower_case_table_names) { - my_casedn_str(my_charset_latin1, db); - my_casedn_str(my_charset_latin1, tname); + my_casedn_str(&my_charset_latin1, db); + my_casedn_str(&my_charset_latin1, tname); } key_length = ((uint) strlen(db) + (uint) strlen(user) + (uint) strlen(tname) + 3); @@ -1669,22 +1669,22 @@ public: privs = fix_rights_for_table(privs); cols = fix_rights_for_column(cols); - (void) hash_init(&hash_columns,my_charset_latin1, + (void) hash_init(&hash_columns,&my_charset_latin1, 0,0,0, (hash_get_key) get_key_column,0, HASH_CASE_INSENSITIVE); if (cols) { int key_len; - col_privs->field[0]->store(host,(uint) strlen(host), my_charset_latin1); - col_privs->field[1]->store(db,(uint) strlen(db), my_charset_latin1); - col_privs->field[2]->store(user,(uint) strlen(user), my_charset_latin1); - col_privs->field[3]->store(tname,(uint) strlen(tname), my_charset_latin1); + col_privs->field[0]->store(host,(uint) strlen(host), &my_charset_latin1); + col_privs->field[1]->store(db,(uint) strlen(db), &my_charset_latin1); + col_privs->field[2]->store(user,(uint) strlen(user), &my_charset_latin1); + col_privs->field[3]->store(tname,(uint) strlen(tname), &my_charset_latin1); key_len=(col_privs->field[0]->pack_length()+ col_privs->field[1]->pack_length()+ col_privs->field[2]->pack_length()+ col_privs->field[3]->pack_length()); key_copy(key,col_privs,0,key_len); - col_privs->field[4]->store("",0, my_charset_latin1); + col_privs->field[4]->store("",0, &my_charset_latin1); col_privs->file->index_init(0); if (col_privs->file->index_read(col_privs->record[0], (byte*) col_privs->field[0]->ptr, @@ -1752,15 +1752,15 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip, if (exact) { if ((host && - !my_strcasecmp(my_charset_latin1, host, grant_table->host)) || + !my_strcasecmp(&my_charset_latin1, host, grant_table->host)) || (ip && !strcmp(ip,grant_table->host))) return grant_table; } else { - if ((host && !wild_case_compare(my_charset_latin1, + if ((host && !wild_case_compare(&my_charset_latin1, host,grant_table->host)) || - (ip && !wild_case_compare(my_charset_latin1, + (ip && !wild_case_compare(&my_charset_latin1, ip,grant_table->host))) found=grant_table; // Host ok } @@ -1788,10 +1788,10 @@ static int replace_column_table(GRANT_TABLE *g_t, byte key[MAX_KEY_LENGTH]; DBUG_ENTER("replace_column_table"); - table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1); - table->field[1]->store(db,(uint) strlen(db), my_charset_latin1); - table->field[2]->store(combo.user.str,combo.user.length, my_charset_latin1); - table->field[3]->store(table_name,(uint) strlen(table_name), my_charset_latin1); + table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1); + table->field[1]->store(db,(uint) strlen(db), &my_charset_latin1); + table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1); + table->field[3]->store(table_name,(uint) strlen(table_name), &my_charset_latin1); key_length=(table->field[0]->pack_length()+ table->field[1]->pack_length()+ table->field[2]->pack_length()+ table->field[3]->pack_length()); key_copy(key,table,0,key_length); @@ -1808,7 +1808,7 @@ static int replace_column_table(GRANT_TABLE *g_t, ulong privileges = xx->rights; bool old_row_exists=0; key_restore(table,key,0,key_length); - table->field[4]->store(xx->column.ptr(),xx->column.length(),my_charset_latin1); + table->field[4]->store(xx->column.ptr(),xx->column.length(),&my_charset_latin1); if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr, 0, HA_READ_KEY_EXACT)) @@ -1824,7 +1824,7 @@ static int replace_column_table(GRANT_TABLE *g_t, old_row_exists = 0; restore_record(table,2); // Get empty record key_restore(table,key,0,key_length); - table->field[4]->store(xx->column.ptr(),xx->column.length(), my_charset_latin1); + table->field[4]->store(xx->column.ptr(),xx->column.length(), &my_charset_latin1); } else { @@ -1896,7 +1896,7 @@ static int replace_column_table(GRANT_TABLE *g_t, { GRANT_COLUMN *grant_column = NULL; char colum_name_buf[HOSTNAME_LENGTH+1]; - String column_name(colum_name_buf,sizeof(colum_name_buf),my_charset_latin1); + String column_name(colum_name_buf,sizeof(colum_name_buf),&my_charset_latin1); privileges&= ~rights; table->field[6]->store((longlong) @@ -1966,10 +1966,10 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, } restore_record(table,2); // Get empty record - table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1); - table->field[1]->store(db,(uint) strlen(db), my_charset_latin1); - table->field[2]->store(combo.user.str,combo.user.length, my_charset_latin1); - table->field[3]->store(table_name,(uint) strlen(table_name), my_charset_latin1); + table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1); + table->field[1]->store(db,(uint) strlen(db), &my_charset_latin1); + table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1); + table->field[3]->store(table_name,(uint) strlen(table_name), &my_charset_latin1); store_record(table,1); // store at pos 1 if (table->file->index_read_idx(table->record[0],0, @@ -2014,7 +2014,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, } } - table->field[4]->store(grantor,(uint) strlen(grantor), my_charset_latin1); + table->field[4]->store(grantor,(uint) strlen(grantor), &my_charset_latin1); table->field[6]->store((longlong) store_table_rights); table->field[7]->store((longlong) store_col_rights); rights=fix_rights_for_table(store_table_rights); @@ -2274,7 +2274,7 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, if (lower_case_table_names && db) { strmov(tmp_db,db); - my_casedn_str(my_charset_latin1, tmp_db); + my_casedn_str(&my_charset_latin1, tmp_db); db=tmp_db; } @@ -2363,7 +2363,7 @@ my_bool grant_init(THD *org_thd) DBUG_ENTER("grant_init"); grant_option = FALSE; - (void) hash_init(&column_priv_hash,my_charset_latin1, + (void) hash_init(&column_priv_hash,&my_charset_latin1, 0,0,0, (hash_get_key) get_grant_table, (hash_free_key) free_grant_table,0); init_sql_alloc(&memex,1024,0); @@ -2696,9 +2696,9 @@ bool check_grant_db(THD *thd,const char *db) idx); if (len < grant_table->key_length && !memcmp(grant_table->hash_key,helping,len) && - (thd->host && !wild_case_compare(my_charset_latin1, + (thd->host && !wild_case_compare(&my_charset_latin1, thd->host,grant_table->host) || - (thd->ip && !wild_case_compare(my_charset_latin1, + (thd->ip && !wild_case_compare(&my_charset_latin1, thd->ip,grant_table->host)))) { error=0; // Found match @@ -2825,7 +2825,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) if (!(host=acl_user->host.hostname)) host="%"; if (!strcmp(lex_user->user.str,user) && - !my_strcasecmp(my_charset_latin1, lex_user->host.str, host)) + !my_strcasecmp(&my_charset_latin1, lex_user->host.str, host)) break; } if (counter == acl_users.elements) @@ -2835,7 +2835,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) DBUG_RETURN(-1); } - Item_string *field=new Item_string("",0,my_charset_latin1); + Item_string *field=new Item_string("",0,&my_charset_latin1); List<Item> field_list; field->name=buff; field->max_length=1024; @@ -2853,7 +2853,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) acl_user->ssl_type != SSL_TYPE_NONE) { want_access=acl_user->access; - String global(buff,sizeof(buff),my_charset_latin1); + String global(buff,sizeof(buff),&my_charset_latin1); global.length(0); global.append("GRANT ",6); @@ -2972,12 +2972,12 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) host=""; if (!strcmp(lex_user->user.str,user) && - !my_strcasecmp(my_charset_latin1, lex_user->host.str, host)) + !my_strcasecmp(&my_charset_latin1, lex_user->host.str, host)) { want_access=acl_db->access; if (want_access) { - String db(buff,sizeof(buff),my_charset_latin1); + String db(buff,sizeof(buff),&my_charset_latin1); db.length(0); db.append("GRANT ",6); @@ -3031,12 +3031,12 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) host=""; if (!strcmp(lex_user->user.str,user) && - !my_strcasecmp(my_charset_latin1, lex_user->host.str, host)) + !my_strcasecmp(&my_charset_latin1, lex_user->host.str, host)) { want_access=grant_table->privs; if ((want_access | grant_table->cols) != 0) { - String global(buff,sizeof(buff),my_charset_latin1); + String global(buff,sizeof(buff),&my_charset_latin1); global.length(0); global.append("GRANT ",6); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index a823573a2d9..b3b69c0a3a6 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -529,7 +529,7 @@ bool select_send::send_data(List<Item> &items) List_iterator_fast<Item> li(items); Protocol *protocol= thd->protocol; char buff[MAX_FIELD_WIDTH]; - String buffer(buff, sizeof(buff), my_charset_bin); + String buffer(buff, sizeof(buff), &my_charset_bin); DBUG_ENTER("send_data"); protocol->prepare_for_resend(); @@ -652,7 +652,7 @@ bool select_export::send_data(List<Item> &items) DBUG_ENTER("send_data"); char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH]; bool space_inited=0; - String tmp(buff,sizeof(buff),my_charset_bin),*res; + String tmp(buff,sizeof(buff),&my_charset_bin),*res; tmp.length(0); if (unit->offset_limit_cnt) @@ -860,7 +860,7 @@ bool select_dump::send_data(List<Item> &items) { List_iterator_fast<Item> li(items); char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff),my_charset_bin),*res; + String tmp(buff,sizeof(buff),&my_charset_bin),*res; tmp.length(0); Item *item; DBUG_ENTER("send_data"); diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 2bac815d12a..e4c44428242 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -22,7 +22,7 @@ ** Get help on string ***************************************************************************/ -#define help_charset my_charset_latin1 +#define help_charset &my_charset_latin1 MI_INFO *open_help_file(THD *thd, const char *name) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ac79f4ebcf6..9f77ae5f1f5 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2734,7 +2734,7 @@ mysql_execute_command(THD *thd) if (user->password.str && (strcmp(thd->user,user->user.str) || user->host.str && - my_strcasecmp(my_charset_latin1, + my_strcasecmp(&my_charset_latin1, user->host.str, thd->host_or_ip))) { if (check_access(thd, UPDATE_ACL, "mysql",0,1)) @@ -3415,7 +3415,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type, /* Convert long CHAR() and VARCHAR columns to TEXT or BLOB */ new_field->sql_type= FIELD_TYPE_BLOB; sprintf(warn_buff, ER(ER_AUTO_CONVERT), field_name, "CHAR", - (cs == my_charset_bin) ? "BLOB" : "TEXT"); + (cs == &my_charset_bin) ? "BLOB" : "TEXT"); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_AUTO_CONVERT, warn_buff); /* fall through */ diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e554ac1d560..5696f59a3df 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3819,7 +3819,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, case Item_sum::AVG_FUNC: /* Place for sum & count */ if (group) return new Field_string(sizeof(double)+sizeof(longlong), - maybe_null, item->name,table,my_charset_bin); + maybe_null, item->name,table,&my_charset_bin); else return new Field_double(item_sum->max_length,maybe_null, item->name, table, item_sum->decimals); @@ -3827,7 +3827,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, case Item_sum::STD_FUNC: if (group) return new Field_string(sizeof(double)*2+sizeof(longlong), - maybe_null, item->name,table,my_charset_bin); + maybe_null, item->name,table,&my_charset_bin); else return new Field_double(item_sum->max_length, maybe_null, item->name,table,item_sum->decimals); @@ -4360,7 +4360,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, (uchar*) 0, (uint) 0, Field::NONE, - NullS, table, my_charset_bin); + NullS, table, &my_charset_bin); key_part_info->key_type=FIELDFLAG_BINARY; key_part_info->type= HA_KEYTYPE_BINARY; key_part_info++; diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 654076c3f41..ce1b469bf5e 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -124,14 +124,14 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs) if (decimals >= NOT_FIXED_DEC) { sprintf(buff,"%.14g",num); // Enough for a DATETIME - return copy(buff, (uint32) strlen(buff), my_charset_latin1, cs); + return copy(buff, (uint32) strlen(buff), &my_charset_latin1, cs); } #ifdef HAVE_FCONVERT int decpt,sign; char *pos,*to; VOID(fconvert(num,(int) decimals,&decpt,&sign,buff+1)); - if (!my_isdigit(my_charset_latin1, buff[1])) + if (!my_isdigit(&my_charset_latin1, buff[1])) { // Nan or Inf pos=buff+1; if (sign) @@ -139,7 +139,7 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs) buff[0]='-'; pos=buff; } - return copy(pos,(uint32) strlen(pos), my_charset_latin1, cs); + return copy(pos,(uint32) strlen(pos), &my_charset_latin1, cs); } if (alloc((uint32) ((uint32) decpt+3+decimals))) return TRUE; @@ -189,7 +189,7 @@ end: #else sprintf(buff,"%.*f",(int) decimals,num); #endif - return copy(buff,(uint32) strlen(buff), my_charset_latin1, cs); + return copy(buff,(uint32) strlen(buff), &my_charset_latin1, cs); #endif } @@ -267,7 +267,7 @@ bool String::set_latin1(const char *str, uint32 arg_length) set(str, arg_length, str_charset); return 0; } - return copy(str, arg_length, my_charset_latin1, str_charset); + return copy(str, arg_length, &my_charset_latin1, str_charset); } @@ -322,7 +322,7 @@ bool String::append(const char *s,uint32 arg_length) if (realloc(str_length+ add_length)) return TRUE; str_length+= copy_and_convert(Ptr+str_length, add_length, str_charset, - s, arg_length, my_charset_latin1); + s, arg_length, &my_charset_latin1); return FALSE; } if (realloc(str_length+arg_length)) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 3aae6f6f411..3d94c39ff7b 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -573,7 +573,7 @@ multi_update::initialize_tables(JOIN *join) /* ok to be on stack as this is not referenced outside of this func */ Field_string offset(table->file->ref_length, 0, "offset", - table, my_charset_bin); + table, &my_charset_bin); if (temp_fields.push_front(new Item_field(((Field *) &offset)))) DBUG_RETURN(1); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 239e8728d48..899061f2528 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1119,12 +1119,12 @@ type: | char opt_binary { Lex->length=(char*) "1"; $$=FIELD_TYPE_STRING; } | BINARY '(' NUM ')' { Lex->length=$3.str; - Lex->charset=my_charset_bin; + Lex->charset=&my_charset_bin; $$=FIELD_TYPE_STRING; } | varchar '(' NUM ')' opt_binary { Lex->length=$3.str; $$=FIELD_TYPE_VAR_STRING; } | VARBINARY '(' NUM ')' { Lex->length=$3.str; - Lex->charset=my_charset_bin; + Lex->charset=&my_charset_bin; $$=FIELD_TYPE_VAR_STRING; } | YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; } | DATE_SYM { $$=FIELD_TYPE_DATE; } @@ -1139,17 +1139,17 @@ type: | TIMESTAMP '(' NUM ')' { Lex->length=$3.str; $$=FIELD_TYPE_TIMESTAMP; } | DATETIME { $$=FIELD_TYPE_DATETIME; } - | TINYBLOB { Lex->charset=my_charset_bin; + | TINYBLOB { Lex->charset=&my_charset_bin; $$=FIELD_TYPE_TINY_BLOB; } - | BLOB_SYM opt_len { Lex->charset=my_charset_bin; + | BLOB_SYM opt_len { Lex->charset=&my_charset_bin; $$=FIELD_TYPE_BLOB; } - | GEOMETRY_SYM { Lex->charset=my_charset_bin; + | GEOMETRY_SYM { Lex->charset=&my_charset_bin; $$=FIELD_TYPE_GEOMETRY; } - | MEDIUMBLOB { Lex->charset=my_charset_bin; + | MEDIUMBLOB { Lex->charset=&my_charset_bin; $$=FIELD_TYPE_MEDIUM_BLOB; } - | LONGBLOB { Lex->charset=my_charset_bin; + | LONGBLOB { Lex->charset=&my_charset_bin; $$=FIELD_TYPE_LONG_BLOB; } - | LONG_SYM VARBINARY { Lex->charset=my_charset_bin; + | LONG_SYM VARBINARY { Lex->charset=&my_charset_bin; $$=FIELD_TYPE_MEDIUM_BLOB; } | LONG_SYM varchar opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; } | TINYTEXT opt_binary { $$=FIELD_TYPE_TINY_BLOB; } @@ -1297,9 +1297,9 @@ opt_default: opt_binary: /* empty */ { Lex->charset=NULL; } - | ASCII_SYM { Lex->charset=my_charset_latin1; } - | BYTE_SYM { Lex->charset=my_charset_bin; } - | BINARY { Lex->charset=my_charset_bin; } + | ASCII_SYM { Lex->charset=&my_charset_latin1; } + | BYTE_SYM { Lex->charset=&my_charset_bin; } + | BINARY { Lex->charset=&my_charset_bin; } | UNICODE_SYM { if (!(Lex->charset=get_charset_by_name("ucs2",MYF(0)))) @@ -2087,7 +2087,7 @@ simple_expr: { Select->add_ftfunc_to_list((Item_func_match *) ($$=new Item_func_match_bool(*$2,$5))); } | ASCII_SYM '(' expr ')' { $$= new Item_func_ascii($3); } - | BINARY expr %prec NEG { $$= new Item_func_set_collation($2,my_charset_bin); } + | BINARY expr %prec NEG { $$= new Item_func_set_collation($2,&my_charset_bin); } | CAST_SYM '(' expr AS cast_type ')' { $$= create_func_cast($3, $5); } | CASE_SYM opt_expr WHEN_SYM when_list opt_else END { $$= new Item_func_case(* $4, $2, $5 ); } diff --git a/sql/time.cc b/sql/time.cc index 76e67115a92..96f628dbb14 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -452,7 +452,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) DBUG_PRINT("enter",("str: %.*s",length,str)); // Skip garbage - for (; str != end && !my_isdigit(my_charset_latin1, *str) ; str++) ; + for (; str != end && !my_isdigit(&my_charset_latin1, *str) ; str++) ; if (str == end) DBUG_RETURN(TIMESTAMP_NONE); /* @@ -460,15 +460,15 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) If length= 8 or >= 14 then year is of format YYYY. (YYYY-MM-DD, YYYYMMDD, YYYYYMMDDHHMMSS) */ - for (pos=str; pos != end && my_isdigit(my_charset_latin1,*pos) ; pos++) ; + for (pos=str; pos != end && my_isdigit(&my_charset_latin1,*pos) ; pos++) ; digits= (uint) (pos-str); year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2; field_length=year_length-1; not_zero_date= 0; - for (i=0 ; i < 6 && str != end && my_isdigit(my_charset_latin1,*str) ; i++) + for (i=0 ; i < 6 && str != end && my_isdigit(&my_charset_latin1,*str) ; i++) { uint tmp_value=(uint) (uchar) (*str++ - '0'); - while (str != end && my_isdigit(my_charset_latin1,str[0]) && + while (str != end && my_isdigit(&my_charset_latin1,str[0]) && field_length--) { tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0'); @@ -481,11 +481,11 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) else if ( i != 5 ) // Skip inter-field delimiters { while (str != end && - (my_ispunct(my_charset_latin1,*str) || - my_isspace(my_charset_latin1,*str))) + (my_ispunct(&my_charset_latin1,*str) || + my_isspace(&my_charset_latin1,*str))) { // Only allow space between days and hours - if (my_isspace(my_charset_latin1,*str) && i != 2) + if (my_isspace(&my_charset_latin1,*str) && i != 2) DBUG_RETURN(TIMESTAMP_NONE); str++; } @@ -494,12 +494,12 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) } /* Handle second fractions */ if (i == 6 && (uint) (end-str) >= 2 && *str == '.' && - my_isdigit(my_charset_latin1,str[1])) + my_isdigit(&my_charset_latin1,str[1])) { str++; uint tmp_value=(uint) (uchar) (*str - '0'); field_length=3; - while (str++ != end && my_isdigit(my_charset_latin1,str[0]) && + while (str++ != end && my_isdigit(&my_charset_latin1,str[0]) && field_length--) tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0'); date[6]=tmp_value; @@ -522,7 +522,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) { for (; str != end ; str++) { - if (!my_isspace(my_charset_latin1, *str)) + if (!my_isspace(&my_charset_latin1, *str)) { not_zero_date= 1; // Give warning break; @@ -537,7 +537,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) { for (; str != end ; str++) { - if (!my_isspace(my_charset_latin1,*str)) + if (!my_isspace(&my_charset_latin1,*str)) { current_thd->cuted_fields++; break; @@ -599,7 +599,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time) l_time->neg=0; for (; str != end && - !my_isdigit(my_charset_latin1,*str) && *str != '-' ; str++) + !my_isdigit(&my_charset_latin1,*str) && *str != '-' ; str++) length--; if (str != end && *str == '-') { @@ -618,7 +618,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time) } /* Not a timestamp. Try to get this as a DAYS_TO_SECOND string */ - for (value=0; str != end && my_isdigit(my_charset_latin1,*str) ; str++) + for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++) value=value*10L + (long) (*str - '0'); if (*str == ' ') @@ -630,7 +630,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time) LINT_INIT(state); found_days=found_hours=0; if ((uint) (end-str) > 1 && (*str == ' ' && - my_isdigit(my_charset_latin1,str[1]))) + my_isdigit(&my_charset_latin1,str[1]))) { // days ! date[0]=value; state=1; // Assume next is hours @@ -638,7 +638,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time) str++; // Skip space; } else if ((end-str) > 1 && *str == ':' && - my_isdigit(my_charset_latin1,str[1])) + my_isdigit(&my_charset_latin1,str[1])) { date[0]=0; // Assume we found hours date[1]=value; @@ -660,11 +660,11 @@ bool str_to_time(const char *str,uint length,TIME *l_time) /* Read hours, minutes and seconds */ for (;;) { - for (value=0; str != end && my_isdigit(my_charset_latin1,*str) ; str++) + for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++) value=value*10L + (long) (*str - '0'); date[state++]=value; if (state == 4 || (end-str) < 2 || *str != ':' || - !my_isdigit(my_charset_latin1,str[1])) + !my_isdigit(&my_charset_latin1,str[1])) break; str++; // Skip ':' } @@ -684,12 +684,12 @@ bool str_to_time(const char *str,uint length,TIME *l_time) fractional: /* Get fractional second part */ - if ((end-str) >= 2 && *str == '.' && my_isdigit(my_charset_latin1,str[1])) + if ((end-str) >= 2 && *str == '.' && my_isdigit(&my_charset_latin1,str[1])) { uint field_length=3; str++; value=(uint) (uchar) (*str - '0'); while (++str != end && - my_isdigit(my_charset_latin1,str[0]) && + my_isdigit(&my_charset_latin1,str[0]) && field_length--) value=value*10 + (uint) (uchar) (*str - '0'); date[4]=value; @@ -715,7 +715,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time) { do { - if (!my_isspace(my_charset_latin1,*str)) + if (!my_isspace(&my_charset_latin1,*str)) { current_thd->cuted_fields++; break; |