summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <tsmith/tim@siva.hindu.god>2006-08-23 16:30:05 -0600
committerunknown <tsmith/tim@siva.hindu.god>2006-08-23 16:30:05 -0600
commita9eebc998631280be56f5668cf6f182b61b9e78c (patch)
treeda8fe892d7c3fd0a7d4cf30367cea809abaa4864 /sql
parent4934231545c994b90517b2c1b4c9b85b4fbe2018 (diff)
parent216f20ad0067a2f3f8349cff3f10355f7ea7677e (diff)
downloadmariadb-git-a9eebc998631280be56f5668cf6f182b61b9e78c.tar.gz
Merge siva.hindu.god:/usr/home/tim/m/bk/b20536-41
into siva.hindu.god:/usr/home/tim/m/bk/41 sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged sql/slave.cc: Auto merged sql/sql_acl.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/item_strfunc.cc14
-rw-r--r--sql/item_strfunc.h26
2 files changed, 32 insertions, 8 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 1c5b947cb2b..e6cb23a9b88 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -88,6 +88,7 @@ String *Item_func_md5::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String * sptr= args[0]->val_str(str);
+ str->set_charset(&my_charset_bin);
if (sptr)
{
my_MD5_CTX context;
@@ -134,6 +135,7 @@ String *Item_func_sha::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String * sptr= args[0]->val_str(str);
+ str->set_charset(&my_charset_bin);
if (sptr) /* If we got value different from NULL */
{
SHA1_CONTEXT context; /* Context used to generate SHA1 hash */
@@ -1546,7 +1548,7 @@ String *Item_func_encrypt::val_str(String *str)
null_value= 1;
return 0;
}
- str->set(tmp,(uint) strlen(tmp),res->charset());
+ str->set(tmp, (uint) strlen(tmp), &my_charset_bin);
str->copy();
pthread_mutex_unlock(&LOCK_crypt);
return str;
@@ -1943,7 +1945,7 @@ String *Item_func_make_set::val_str(String *str)
return &my_empty_string;
result= &tmp_str;
}
- if (tmp_str.append(',') || tmp_str.append(*res))
+ if (tmp_str.append(",", 1, &my_charset_bin) || tmp_str.append(*res))
return &my_empty_string;
}
}
@@ -2609,8 +2611,12 @@ String* Item_func_export_set::val_str(String* str)
}
break;
case 3:
- sep_buf.set(",", 1, default_charset());
- sep = &sep_buf;
+ {
+ /* errors is not checked - assume "," can always be converted */
+ uint errors;
+ sep_buf.copy(",", 1, &my_charset_bin, collation.collation, &errors);
+ sep = &sep_buf;
+ }
break;
default:
DBUG_ASSERT(0); // cannot happen
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 880a19242ca..b7cecad9516 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -41,7 +41,10 @@ class Item_func_md5 :public Item_str_func
{
String tmp_value;
public:
- Item_func_md5(Item *a) :Item_str_func(a) {}
+ Item_func_md5(Item *a) :Item_str_func(a)
+ {
+ collation.set(&my_charset_bin);
+ }
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "md5"; }
@@ -51,7 +54,10 @@ public:
class Item_func_sha :public Item_str_func
{
public:
- Item_func_sha(Item *a) :Item_str_func(a) {}
+ Item_func_sha(Item *a) :Item_str_func(a)
+ {
+ collation.set(&my_charset_bin);
+ }
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "sha"; }
@@ -310,9 +316,21 @@ public:
class Item_func_encrypt :public Item_str_func
{
String tmp_value;
+
+ /* Encapsulate common constructor actions */
+ void constructor_helper()
+ {
+ collation.set(&my_charset_bin);
+ }
public:
- Item_func_encrypt(Item *a) :Item_str_func(a) {}
- Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
+ Item_func_encrypt(Item *a) :Item_str_func(a)
+ {
+ constructor_helper();
+ }
+ Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b)
+ {
+ constructor_helper();
+ }
String *val_str(String *);
void fix_length_and_dec() { maybe_null=1; max_length = 13; }
const char *func_name() const { return "ecrypt"; }