summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorMikael Ronström <mikael@dator9>2011-04-15 15:46:11 +0200
committerMikael Ronström <mikael@dator9>2011-04-15 15:46:11 +0200
commit70ed67e1ccf8b1696e0c11aa6fb1e5fdb28875fb (patch)
treea3b95707a820bf6af5adbb68c73f6f51dbf5b473 /sql/sql_prepare.cc
parent55557e223f6c89b16cbed2fecd90c26b519b6b92 (diff)
parent060541c02e6c332db0f08fa3b861cb2de305c71f (diff)
downloadmariadb-git-70ed67e1ccf8b1696e0c11aa6fb1e5fdb28875fb.tar.gz
Merge 5.5
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc36
1 files changed, 24 insertions, 12 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 31adbe5db36..dd16bda60ec 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2784,6 +2784,7 @@ void mysql_sql_stmt_close(THD *thd)
}
}
+
/**
Handle long data in pieces from client.
@@ -2840,16 +2841,26 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
param= stmt->param_array[param_number];
+ Diagnostics_area new_stmt_da, *save_stmt_da= thd->stmt_da;
+ Warning_info new_warnning_info(thd->query_id, false);
+ Warning_info *save_warinig_info= thd->warning_info;
+
+ thd->stmt_da= &new_stmt_da;
+ thd->warning_info= &new_warnning_info;
+
#ifndef EMBEDDED_LIBRARY
- if (param->set_longdata(packet, (ulong) (packet_end - packet)))
+ param->set_longdata(packet, (ulong) (packet_end - packet));
#else
- if (param->set_longdata(thd->extra_data, thd->extra_length))
+ param->set_longdata(thd->extra_data, thd->extra_length);
#endif
+ if (thd->stmt_da->is_error())
{
stmt->state= Query_arena::STMT_ERROR;
- stmt->last_errno= ER_OUTOFMEMORY;
- sprintf(stmt->last_error, ER(ER_OUTOFMEMORY), 0);
+ stmt->last_errno= thd->stmt_da->sql_errno();
+ strncpy(stmt->last_error, thd->stmt_da->message(), MYSQL_ERRMSG_SIZE);
}
+ thd->stmt_da= save_stmt_da;
+ thd->warning_info= save_warinig_info;
general_log_print(thd, thd->command, NullS);
@@ -3389,6 +3400,13 @@ Prepared_statement::execute_loop(String *expanded_query,
bool error;
int reprepare_attempt= 0;
+ /* Check if we got an error when sending long data */
+ if (state == Query_arena::ERROR)
+ {
+ my_message(last_errno, last_error, MYF(0));
+ return TRUE;
+ }
+
if (set_parameters(expanded_query, packet, packet_end))
return TRUE;
@@ -3656,12 +3674,6 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
status_var_increment(thd->status_var.com_stmt_execute);
- /* Check if we got an error when sending long data */
- if (state == Query_arena::STMT_ERROR)
- {
- my_message(last_errno, last_error, MYF(0));
- return TRUE;
- }
if (flags & (uint) IS_IN_USE)
{
my_error(ER_PS_NO_RECURSION, MYF(0));
@@ -3889,7 +3901,7 @@ Ed_result_set::Ed_result_set(List<Ed_row> *rows_arg,
*/
Ed_connection::Ed_connection(THD *thd)
- :m_warning_info(thd->query_id),
+ :m_warning_info(thd->query_id, false),
m_thd(thd),
m_rsets(0),
m_current_rset(0)