mirror of
https://github.com/MariaDB/server.git
synced 2026-04-30 04:05:32 +02:00
Merge with MariaDB 5.2
This commit is contained in:
commit
f34be18938
639 changed files with 11584 additions and 4494 deletions
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2002, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009-2011, Monty Program Ab
|
||||
|
||||
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
|
||||
|
|
@ -107,7 +108,7 @@ class Select_fetch_protocol_binary: public select_send
|
|||
public:
|
||||
Select_fetch_protocol_binary(THD *thd);
|
||||
virtual bool send_fields(List<Item> &list, uint flags);
|
||||
virtual bool send_data(List<Item> &items);
|
||||
virtual int send_data(List<Item> &items);
|
||||
virtual bool send_eof();
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
void begin_dataset()
|
||||
|
|
@ -2793,6 +2794,32 @@ void mysql_sql_stmt_close(THD *thd)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class Set_longdata_error_handler : public Internal_error_handler
|
||||
{
|
||||
public:
|
||||
Set_longdata_error_handler(Prepared_statement *statement)
|
||||
: stmt(statement)
|
||||
{ }
|
||||
|
||||
public:
|
||||
bool handle_error(uint sql_errno,
|
||||
const char *message,
|
||||
MYSQL_ERROR::enum_warning_level level,
|
||||
THD *)
|
||||
{
|
||||
stmt->state= Query_arena::ERROR;
|
||||
stmt->last_errno= sql_errno;
|
||||
strnmov(stmt->last_error, message, MYSQL_ERRMSG_SIZE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
private:
|
||||
Prepared_statement *stmt;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Handle long data in pieces from client.
|
||||
|
||||
|
|
@ -2849,16 +2876,19 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
|
|||
|
||||
param= stmt->param_array[param_number];
|
||||
|
||||
Set_longdata_error_handler err_handler(stmt);
|
||||
/*
|
||||
Install handler that will catch any errors that can be generated
|
||||
during execution of Item_param::set_longdata() and propagate
|
||||
them to Statement::last_error.
|
||||
*/
|
||||
thd->push_internal_handler(&err_handler);
|
||||
#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
|
||||
{
|
||||
stmt->state= Query_arena::ERROR;
|
||||
stmt->last_errno= ER_OUTOFMEMORY;
|
||||
sprintf(stmt->last_error, ER(ER_OUTOFMEMORY), 0);
|
||||
}
|
||||
thd->pop_internal_handler();
|
||||
|
||||
general_log_print(thd, thd->command, NullS);
|
||||
|
||||
|
|
@ -2899,11 +2929,11 @@ bool Select_fetch_protocol_binary::send_eof()
|
|||
}
|
||||
|
||||
|
||||
bool
|
||||
int
|
||||
Select_fetch_protocol_binary::send_data(List<Item> &fields)
|
||||
{
|
||||
Protocol *save_protocol= thd->protocol;
|
||||
bool rc;
|
||||
int rc;
|
||||
|
||||
thd->protocol= &protocol;
|
||||
rc= select_send::send_data(fields);
|
||||
|
|
@ -3320,6 +3350,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;
|
||||
|
||||
|
|
@ -3560,12 +3597,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::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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue