Commit cd955119 authored by unknown's avatar unknown

Another fix for #2208

previous one had error


libmysqld/lib_sql.cc:
  memdup_mysql deleted
sql/sql_class.h:
  String instead of char*
sql/sql_parse.cc:
  storing of the rest of the query
parent 3ab19c26
......@@ -251,7 +251,7 @@ int emb_next_result(MYSQL *mysql)
DBUG_ENTER("emb_next_result");
if (emb_advanced_command(mysql, COM_QUERY,0,0,
thd->query_rest,thd->query_rest_length,1)
thd->query_rest.ptr(),thd->query_rest.length(),1)
|| emb_mysql_read_query_result(mysql))
DBUG_RETURN(1);
......@@ -765,11 +765,6 @@ bool Protocol::net_store_data(const char *from, uint length)
return false;
}
char *memdup_mysql(struct st_mysql *mysql, const char*data, int length)
{
return memdup_root(&mysql->field_alloc, data, length);
}
#if 0
/* The same as Protocol::net_store_data but does the converstion
*/
......
......@@ -565,8 +565,7 @@ class THD :public ilink,
struct st_mysql_bind *client_params;
char *extra_data;
ulong extra_length;
char *query_rest;
uint32 query_rest_length;
String query_rest;
#endif
NET net; // client connection descriptor
MEM_ROOT warn_root; // For warnings and errors
......
......@@ -48,7 +48,6 @@
extern "C" int gethostname(char *name, int namelen);
#endif
char *memdup_mysql(struct st_mysql *mysql, const char*data, int length);
static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
static void decrease_user_connections(USER_CONN *uc);
static bool check_db_used(THD *thd,TABLE_LIST *tables);
......@@ -1420,8 +1419,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#ifndef EMBEDDED_LIBRARY
mysql_parse(thd, packet, length);
#else
thd->query_rest= (char*)memdup_mysql(thd->mysql, packet, length);
thd->query_rest_length= length;
/*
'packet' can point inside the query_rest's buffer
so we have to do memmove here
*/
if (thd->query_rest.length() > length)
{
memmove(thd->query_rest.c_ptr(), packet, length);
thd->query_rest.length(length);
}
else
thd->query_rest.copy(length);
break;
#endif /*EMBEDDED_LIBRARY*/
}
......
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