Commit 4b5bfe99 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

sql_acl.cc, item.h:

  use of new argument
sql_analyse.h:
  macros from mysql_priv.h. Should be deleted soon.
mysql_priv.h:
  _default_charset_info has been removed
item_cmpfunc.h:
  Use cmp_charset
hostname.cc, hash_filo.h:
  Move charset to constructor argument
parent d09d2b85
...@@ -42,6 +42,7 @@ class hash_filo ...@@ -42,6 +42,7 @@ class hash_filo
const hash_get_key get_key; const hash_get_key get_key;
hash_free_key free_element; hash_free_key free_element;
bool init; bool init;
CHARSET_INFO *hash_charset;
hash_filo_element *first_link,*last_link; hash_filo_element *first_link,*last_link;
public: public:
...@@ -49,9 +50,11 @@ public: ...@@ -49,9 +50,11 @@ public:
HASH cache; HASH cache;
hash_filo(uint size_arg, uint key_offset_arg , uint key_length_arg, hash_filo(uint size_arg, uint key_offset_arg , uint key_length_arg,
hash_get_key get_key_arg, hash_free_key free_element_arg) hash_get_key get_key_arg, hash_free_key free_element_arg,
CHARSET_INFO *hash_charset_arg)
:size(size_arg), key_offset(key_offset_arg), key_length(key_length_arg), :size(size_arg), key_offset(key_offset_arg), key_length(key_length_arg),
get_key(get_key_arg), free_element(free_element_arg),init(0) get_key(get_key_arg), free_element(free_element_arg),init(0),
hash_charset(hash_charset_arg)
{ {
bzero((char*) &cache,sizeof(cache)); bzero((char*) &cache,sizeof(cache));
} }
...@@ -75,7 +78,7 @@ public: ...@@ -75,7 +78,7 @@ public:
if (!locked) if (!locked)
(void) pthread_mutex_lock(&lock); (void) pthread_mutex_lock(&lock);
(void) hash_free(&cache); (void) hash_free(&cache);
(void) hash_init(&cache,system_charset_info,size,key_offset, (void) hash_init(&cache,hash_charset,size,key_offset,
key_length, get_key, free_element,0); key_length, get_key, free_element,0);
if (!locked) if (!locked)
(void) pthread_mutex_unlock(&lock); (void) pthread_mutex_unlock(&lock);
......
...@@ -65,7 +65,8 @@ bool hostname_cache_init() ...@@ -65,7 +65,8 @@ bool hostname_cache_init()
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset, if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
sizeof(struct in_addr),NULL, sizeof(struct in_addr),NULL,
(hash_free_key) free))) (hash_free_key) free,
&my_charset_latin1)))
return 1; return 1;
hostname_cache->clear(); hostname_cache->clear();
return 0; return 0;
......
...@@ -393,8 +393,7 @@ public: ...@@ -393,8 +393,7 @@ public:
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
Item *new_item() Item *new_item()
{ {
return new Item_string(name, str_value.ptr(), max_length, return new Item_string(name, str_value.ptr(), max_length, &my_charset_bin);
default_charset_info);
} }
String *const_string() { return &str_value; } String *const_string() { return &str_value; }
inline void append(char *str, uint length) { str_value.append(str, length); } inline void append(char *str, uint length) { str_value.append(str, length); }
...@@ -406,7 +405,8 @@ public: ...@@ -406,7 +405,8 @@ public:
class Item_datetime :public Item_string class Item_datetime :public Item_string
{ {
public: public:
Item_datetime(const char *item_name): Item_string(item_name,"",0,default_charset_info) Item_datetime(const char *item_name): Item_string(item_name,"",0,
&my_charset_bin)
{ max_length=19;} { max_length=19;}
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
}; };
...@@ -414,7 +414,8 @@ public: ...@@ -414,7 +414,8 @@ public:
class Item_empty_string :public Item_string class Item_empty_string :public Item_string
{ {
public: public:
Item_empty_string(const char *header,uint length) :Item_string("",0,default_charset_info) Item_empty_string(const char *header,uint length) :Item_string("",0,
&my_charset_bin)
{ name=(char*) header; max_length=length;} { name=(char*) header; max_length=length;}
}; };
......
...@@ -482,7 +482,7 @@ public: ...@@ -482,7 +482,7 @@ public:
int cmp(Item *arg) int cmp(Item *arg)
{ {
char buff[80]; char buff[80];
String tmp(buff, sizeof(buff), default_charset_info), *res; String tmp(buff, sizeof(buff), cmp_charset), *res;
if (!(res= arg->val_str(&tmp))) if (!(res= arg->val_str(&tmp)))
return 1; /* Can't be right */ return 1; /* Can't be right */
return sortcmp(value_res, res, cmp_charset); return sortcmp(value_res, res, cmp_charset);
......
...@@ -62,7 +62,6 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); ...@@ -62,7 +62,6 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#endif #endif
#endif #endif
#define my_thd_charset default_charset_info
#define files_charset_info system_charset_info #define files_charset_info system_charset_info
/*************************************************************************** /***************************************************************************
......
...@@ -97,7 +97,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) ...@@ -97,7 +97,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
if (!acl_cache) if (!acl_cache)
acl_cache=new hash_filo(ACL_CACHE_SIZE,0,0, acl_cache=new hash_filo(ACL_CACHE_SIZE,0,0,
(hash_get_key) acl_entry_get_key, (hash_get_key) acl_entry_get_key,
(hash_free_key) free); (hash_free_key) free, system_charset_info);
if (dont_read_acl_tables) if (dont_read_acl_tables)
{ {
DBUG_RETURN(0); /* purecov: tested */ DBUG_RETURN(0); /* purecov: tested */
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
#define my_thd_charset default_charset_info
#define DEC_IN_AVG 4 #define DEC_IN_AVG 4
typedef struct st_number_info typedef struct st_number_info
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment