diff options
author | unknown <hf@deer.(none)> | 2004-02-13 11:56:36 +0400 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2004-02-13 11:56:36 +0400 |
commit | f2adc11249255e9474db8a83186d23896b78d740 (patch) | |
tree | f80ed64ab252bd96dc439446b2c7babbb31f4828 /sql | |
parent | 4679b0e319eee6bc3058d82f6cb1e3077f2fb750 (diff) | |
download | mariadb-git-f2adc11249255e9474db8a83186d23896b78d740.tar.gz |
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
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_class.h | 3 | ||||
-rw-r--r-- | sql/sql_parse.cc | 14 |
2 files changed, 12 insertions, 5 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 5034007cd4d..b8cce3096ef 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -565,8 +565,7 @@ public: 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 diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 51e1ebee4ad..69ee43d53d1 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -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*/ } |