summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorunknown <anozdrin/alik@station.>2007-09-28 15:42:37 +0400
committerunknown <anozdrin/alik@station.>2007-09-28 15:42:37 +0400
commitfa48986a0d1b8214a118b29b95a3e8fdb0fd9eb4 (patch)
tree6ae56aa7b29a8982c29c11eff480ec15c20b6f35 /sql/sql_prepare.cc
parenta73a57554a3360613f842c37a0be4e56e1b51879 (diff)
downloadmariadb-git-fa48986a0d1b8214a118b29b95a3e8fdb0fd9eb4.tar.gz
Prerequisite patch for BUG#30472: libmysql doesn't reset charset,
insert_id after succ. mysql_change_user() call. Supply a correct packet length to dispatch command. sql/sp_head.cc: Fix packet length. sql/sql_parse.cc: Fix packet length. sql/sql_prepare.cc: Fix packet length. tests/mysql_client_test.c: Test case for COM_CHANGE_USER.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index c576a9dba1d..05743b6dfe3 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2107,7 +2107,7 @@ void mysql_sql_stmt_prepare(THD *thd)
DBUG_VOID_RETURN;
}
- if (stmt->prepare(query, query_len+1))
+ if (stmt->prepare(query, query_len))
{
/* Statement map deletes the statement on erase */
thd->stmt_map.erase(stmt);
@@ -2270,7 +2270,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
/* Query text for binary, general or slow log, if any of them is open */
String expanded_query;
#ifndef EMBEDDED_LIBRARY
- uchar *packet_end= packet + packet_length - 1;
+ uchar *packet_end= packet + packet_length;
#endif
Prepared_statement *stmt;
bool error;
@@ -2585,14 +2585,14 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
Prepared_statement *stmt;
Item_param *param;
#ifndef EMBEDDED_LIBRARY
- char *packet_end= packet + packet_length - 1;
+ char *packet_end= packet + packet_length;
#endif
DBUG_ENTER("mysql_stmt_get_longdata");
status_var_increment(thd->status_var.com_stmt_send_long_data);
#ifndef EMBEDDED_LIBRARY
/* Minimal size of long data packet is 6 bytes */
- if (packet_length <= MYSQL_LONG_DATA_HEADER)
+ if (packet_length < MYSQL_LONG_DATA_HEADER)
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "mysql_stmt_send_long_data");
DBUG_VOID_RETURN;
@@ -2866,6 +2866,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
error= parse_sql(thd, &lip, NULL) ||
thd->net.report_error ||
init_param_array(this);
+
lex->set_trg_event_type_for_tables();
/* Remember the current database. */
@@ -3059,7 +3060,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
if (expanded_query->length() &&
alloc_query(thd, (char*) expanded_query->ptr(),
- expanded_query->length()+1))
+ expanded_query->length()))
{
my_error(ER_OUTOFMEMORY, 0, expanded_query->length());
goto error;