summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-02-02 08:21:11 -0800
committerunknown <jimw@mysql.com>2005-02-02 08:21:11 -0800
commit33e74b1427c1e211acc1f06e0384e44bd1edac24 (patch)
treef7feeb6b7dbdf2dd8b64422121decec13f0ae311 /sql
parent6b6e5d4a1612b2c80d5c5f71c3b0ba0ce19d3cc0 (diff)
parent22f839cdd23475075e0f1e9eeeb3c7201f9a4262 (diff)
downloadmariadb-git-33e74b1427c1e211acc1f06e0384e44bd1edac24.tar.gz
Merge fixes for #8248, #5569.
mysql-test/r/func_str.result: Update results mysql-test/t/func_str.test: Merge test sql/item_strfunc.cc: Set charset on output string sql/item_strfunc.h: Merge sql/sql_parse.cc: Merge vio/viosocket.c: Merge
Diffstat (limited to 'sql')
-rw-r--r--sql/item_strfunc.cc17
-rw-r--r--sql/item_strfunc.h1
-rw-r--r--sql/sql_parse.cc3
3 files changed, 9 insertions, 12 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index cee3316886a..1fb68561374 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2614,18 +2614,13 @@ String *Item_func_quote::val_str(String *str)
for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++)
new_length+= get_esc_bit(escmask, (uchar) *from);
- /*
- We have to use realloc() instead of alloc() as we want to keep the
- old result in arg
- */
- if (arg->realloc(new_length))
+ if (tmp_value.alloc(new_length))
goto null;
/*
- As 'arg' and 'str' may be the same string, we must replace characters
- from the end to the beginning
+ We replace characters from the end to the beginning
*/
- to= (char*) arg->ptr() + new_length - 1;
+ to= (char*) tmp_value.ptr() + new_length - 1;
*to--= '\'';
for (start= (char*) arg->ptr(),end= start + arg_length; end-- != start; to--)
{
@@ -2653,10 +2648,10 @@ String *Item_func_quote::val_str(String *str)
}
}
*to= '\'';
- arg->length(new_length);
- str->set_charset(collation.collation);
+ tmp_value.length(new_length);
+ tmp_value.set_charset(collation.collation);
null_value= 0;
- return arg;
+ return &tmp_value;
null:
null_value= 1;
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 698536a61c7..c1c0969672c 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -588,6 +588,7 @@ public:
class Item_func_quote :public Item_str_func
{
+ String tmp_value;
public:
Item_func_quote(Item *a) :Item_str_func(a) {}
const char *func_name() const { return "quote"; }
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 85cd24c4fbb..e66eeb279d2 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -660,6 +660,8 @@ static int check_connection(THD *thd)
DBUG_PRINT("info",
("New connection received on %s", vio_description(net->vio)));
+ vio_in_addr(net->vio,&thd->remote.sin_addr);
+
if (!thd->host) // If TCP/IP connection
{
char ip[30];
@@ -704,7 +706,6 @@ static int check_connection(THD *thd)
DBUG_PRINT("info",("Host: %s",thd->host));
thd->host_or_ip= thd->host;
thd->ip= 0;
- bzero((char*) &thd->remote, sizeof(struct sockaddr));
}
vio_keepalive(net->vio, TRUE);
ulong pkt_len= 0;