#At file:///home/alik/MySQL/bzr/00/bug55843/2011.05.19/mysql-5.5/ based on revid:mayank.prasad@stripped
3388 Alexander Nozdrin 2011-05-19
Pre-requisite patch for Bug#11763162 (55843 - Handled condition
appears as not handled).
Make THD::stmt_da and THD::warning_info private,
and provide getters for them:
- THD::get_stmt_da()
- THD::get_warning_info()
modified:
libmysqld/emb_qcache.cc
libmysqld/lib_sql.cc
sql/event_scheduler.cc
sql/field.cc
sql/filesort.cc
sql/ha_ndbcluster_binlog.cc
sql/handler.cc
sql/log.cc
sql/log_event.cc
sql/log_event_old.cc
sql/opt_sum.cc
sql/protocol.cc
sql/rpl_rli.cc
sql/slave.cc
sql/sp.cc
sql/sp_head.cc
sql/sql_acl.cc
sql/sql_admin.cc
sql/sql_audit.h
sql/sql_base.cc
sql/sql_cache.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_connect.cc
sql/sql_derived.cc
sql/sql_error.cc
sql/sql_insert.cc
sql/sql_load.cc
sql/sql_parse.cc
sql/sql_prepare.cc
sql/sql_select.cc
sql/sql_servers.cc
sql/sql_show.cc
sql/sql_signal.cc
sql/sql_table.cc
sql/sql_time.cc
sql/sql_update.cc
sql/sys_vars.cc
sql/table.cc
sql/thr_malloc.cc
sql/transaction.cc
sql/tztime.cc
=== modified file 'libmysqld/emb_qcache.cc'
--- a/libmysqld/emb_qcache.cc 2010-03-31 14:05:33 +0000
+++ b/libmysqld/emb_qcache.cc 2011-05-19 10:10:49 +0000
@@ -487,7 +487,7 @@ int emb_load_querycache_result(THD *thd,
data->embedded_info->prev_ptr= prev_row;
return_ok:
net_send_eof(thd, thd->server_status,
- thd->warning_info->statement_warn_count());
+ thd->get_warning_info()->statement_warn_count());
DBUG_RETURN(0);
err:
DBUG_RETURN(1);
=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc 2011-05-18 14:17:29 +0000
+++ b/libmysqld/lib_sql.cc 2011-05-19 10:10:49 +0000
@@ -129,7 +129,7 @@ emb_advanced_command(MYSQL *mysql, enum
/* Clear result variables */
thd->clear_error();
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
mysql->affected_rows= ~(my_ulonglong) 0;
mysql->field_count= 0;
net_clear_error(net);
@@ -240,7 +240,7 @@ static my_bool emb_read_prepare_result(M
stmt->stmt_id= thd->client_stmt_id;
stmt->param_count= thd->client_param_count;
stmt->field_count= 0;
- mysql->warning_count= thd->warning_info->statement_warn_count();
+ mysql->warning_count= thd->get_warning_info()->statement_warn_count();
if (thd->first_data)
{
@@ -425,7 +425,7 @@ static void emb_free_embedded_thd(MYSQL
static const char * emb_read_statistics(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
- return thd->is_error() ? thd->stmt_da->message() : "";
+ return thd->is_error() ? thd->get_stmt_da()->message() : "";
}
@@ -1036,7 +1036,7 @@ bool Protocol::send_result_set_metadata(
if (flags & SEND_EOF)
write_eof_packet(thd, thd->server_status,
- thd->warning_info->statement_warn_count());
+ thd->get_warning_info()->statement_warn_count());
DBUG_RETURN(prepare_for_send(list->elements));
err:
=== modified file 'sql/event_scheduler.cc'
--- a/sql/event_scheduler.cc 2010-07-15 13:47:50 +0000
+++ b/sql/event_scheduler.cc 2011-05-19 10:10:49 +0000
@@ -77,7 +77,7 @@ Event_worker_thread::print_warnings(THD
{
MYSQL_ERROR *err;
DBUG_ENTER("evex_print_warnings");
- if (thd->warning_info->is_empty())
+ if (thd->get_warning_info()->is_empty())
DBUG_VOID_RETURN;
char msg_buf[10 * STRING_BUFFER_USUAL_SIZE];
@@ -93,7 +93,7 @@ Event_worker_thread::print_warnings(THD
prefix.append(et->name.str, et->name.length, system_charset_info);
prefix.append("] ", 2);
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
while ((err= it++))
{
String err_msg(msg_buf, sizeof(msg_buf), system_charset_info);
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2011-05-12 12:38:14 +0000
+++ b/sql/field.cc 2011-05-19 10:10:49 +0000
@@ -1171,7 +1171,8 @@ int Field_num::check_int(CHARSET_INFO *c
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"integer", err.ptr(), field_name,
- (ulong) table->in_use->warning_info->current_row_for_warning());
+ (ulong) table->in_use->get_warning_info()->
+ current_row_for_warning());
return 1;
}
/* Test if we have garbage at the end of the given string. */
@@ -2664,7 +2665,8 @@ int Field_new_decimal::store(const char
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"decimal", errmsg.ptr(), field_name,
- (ulong) table->in_use->warning_info->current_row_for_warning());
+ (ulong) table->in_use->get_warning_info()->
+ current_row_for_warning());
DBUG_RETURN(err);
}
@@ -2684,7 +2686,7 @@ int Field_new_decimal::store(const char
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"decimal", errmsg.ptr(), field_name,
- (ulong) table->in_use->warning_info->
+ (ulong) table->in_use->get_warning_info()->
current_row_for_warning());
my_decimal_set_zero(&decimal_value);
break;
@@ -5233,7 +5235,7 @@ bool Field_time::get_date(MYSQL_TIME *lt
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DATA_OUT_OF_RANGE,
ER(ER_WARN_DATA_OUT_OF_RANGE), field_name,
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
return 1;
}
return Field_time::get_time(ltime);
@@ -6232,7 +6234,7 @@ check_string_copy_error(Field_str *field
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"string", tmp, field->field_name,
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
return TRUE;
}
@@ -10050,7 +10052,7 @@ Field::set_warning(MYSQL_ERROR::enum_war
{
thd->cuted_fields+= cuted_increment;
push_warning_printf(thd, level, code, ER(code), field_name,
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
return 0;
}
return level >= MYSQL_ERROR::WARN_LEVEL_WARN;
=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc 2011-02-24 07:00:12 +0000
+++ b/sql/filesort.cc 2011-05-19 10:10:49 +0000
@@ -333,8 +333,10 @@ ha_rows filesort(THD *thd, TABLE *table,
"%s: %s",
MYF(ME_ERROR + ME_WAITTANG),
ER_THD(thd, ER_FILSORT_ABORT),
- kill_errno ? ER(kill_errno) : thd->stmt_da->message());
-
+ kill_errno ?
+ ER(kill_errno) :
+ thd->get_stmt_da()->message());
+
if (global_system_variables.log_warnings > 1)
{
sql_print_warning("%s, host: %s, user: %s, thread: %lu, query: %-.4096s",
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2010-09-20 14:17:32 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-05-19 10:10:49 +0000
@@ -289,13 +289,13 @@ static void run_query(THD *thd, char *bu
Thd_ndb *thd_ndb= get_thd_ndb(thd);
for (i= 0; no_print_error[i]; i++)
if ((thd_ndb->m_error_code == no_print_error[i]) ||
- (thd->stmt_da->sql_errno() == (unsigned) no_print_error[i]))
+ (thd->get_stmt_da()->sql_errno() == (unsigned) no_print_error[i]))
break;
if (!no_print_error[i])
sql_print_error("NDB: %s: error %s %d(ndb: %d) %d %d",
buf,
- thd->stmt_da->message(),
- thd->stmt_da->sql_errno(),
+ thd->get_stmt_da()->message(),
+ thd->get_stmt_da()->sql_errno(),
thd_ndb->m_error_code,
(int) thd->is_error(), thd->is_slave_error);
}
@@ -309,7 +309,7 @@ static void run_query(THD *thd, char *bu
is called from ndbcluster_reset_logs(), which is called from
mysql_flush().
*/
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
thd->variables.option_bits= save_thd_options;
thd->set_query(save_thd_query, save_thd_query_length);
@@ -983,7 +983,7 @@ static void print_could_not_discover_err
"my_errno: %d",
schema->db, schema->name, schema->query,
schema->node_id, my_errno);
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
sql_print_warning("NDB Binlog: (%d)%s", err->get_sql_errno(),
@@ -2337,8 +2337,8 @@ static int open_ndb_binlog_index(THD *th
sql_print_error("NDB Binlog: Opening ndb_binlog_index: killed");
else
sql_print_error("NDB Binlog: Opening ndb_binlog_index: %d, '%s'",
- thd->stmt_da->sql_errno(),
- thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(),
+ thd->get_stmt_da()->message());
thd->proc_info= save_proc_info;
return -1;
}
@@ -2394,9 +2394,9 @@ int ndb_add_ndb_binlog_index(THD *thd, v
}
add_ndb_binlog_index_err:
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
close_thread_tables(thd);
thd->mdl_context.release_transactional_locks();
ndb_binlog_index= 0;
@@ -4265,9 +4265,9 @@ err:
sql_print_information("Stopping Cluster Binlog");
DBUG_PRINT("info",("Shutting down cluster binlog thread"));
thd->proc_info= "Shutting down";
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
close_thread_tables(thd);
thd->mdl_context.release_transactional_locks();
mysql_mutex_lock(&injector_mutex);
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2011-04-20 17:53:08 +0000
+++ b/sql/handler.cc 2011-05-19 10:10:49 +0000
@@ -1392,7 +1392,7 @@ int ha_rollback_trans(THD *thd, bool all
trans->no_2pc=0;
if (is_real_trans && thd->transaction_rollback_request &&
thd->transaction.xid_state.xa_state != XA_NOTR)
- thd->transaction.xid_state.rm_error= thd->stmt_da->sql_errno();
+ thd->transaction.xid_state.rm_error= thd->get_stmt_da()->sql_errno();
}
/* Always cleanup. Even if nht==0. There may be savepoints. */
if (is_real_trans)
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2011-05-12 12:56:00 +0000
+++ b/sql/log.cc 2011-05-19 10:10:49 +0000
@@ -1974,7 +1974,7 @@ bool MYSQL_BIN_LOG::check_write_error(TH
if (!thd->is_error())
DBUG_RETURN(checked);
- switch (thd->stmt_da->sql_errno())
+ switch (thd->get_stmt_da()->sql_errno())
{
case ER_TRANS_CACHE_FULL:
case ER_STMT_CACHE_FULL:
@@ -5312,9 +5312,9 @@ int query_error_code(THD *thd, bool not_
if (not_killed || (thd->killed == THD::KILL_BAD_DATA))
{
- error= thd->is_error() ? thd->stmt_da->sql_errno() : 0;
+ error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0;
- /* thd->stmt_da->sql_errno() might be ER_SERVER_SHUTDOWN or
+ /* thd->get_stmt_da()->sql_errno() might be ER_SERVER_SHUTDOWN or
ER_QUERY_INTERRUPTED, So here we need to make sure that error
is not set to these errors when specified not_killed by the
caller.
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2011-03-25 12:13:17 +0000
+++ b/sql/log_event.cc 2011-05-19 10:10:49 +0000
@@ -147,7 +147,7 @@ static void inline slave_rows_error_repo
char buff[MAX_SLAVE_ERRMSG], *slider;
const char *buff_end= buff + sizeof(buff);
uint len;
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
MYSQL_ERROR *err;
buff[0]= 0;
@@ -160,7 +160,7 @@ static void inline slave_rows_error_repo
}
if (ha_error != 0)
- rli->report(level, thd->is_error() ? thd->stmt_da->sql_errno() : 0,
+ rli->report(level, thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0,
"Could not execute %s event on table %s.%s;"
"%s handler error %s; "
"the event's master log %s, end_log_pos %lu",
@@ -168,7 +168,7 @@ static void inline slave_rows_error_repo
buff, handler_error == NULL ? "<unknown>" : handler_error,
log_name, pos);
else
- rli->report(level, thd->is_error() ? thd->stmt_da->sql_errno() : 0,
+ rli->report(level, thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0,
"Could not execute %s event on table %s.%s;"
"%s the event's master log %s, end_log_pos %lu",
type, table->s->db.str, table->s->table_name.str,
@@ -372,13 +372,13 @@ inline int ignored_error_code(int err_co
*/
int convert_handler_error(int error, THD* thd, TABLE *table)
{
- uint actual_error= (thd->is_error() ? thd->stmt_da->sql_errno() :
+ uint actual_error= (thd->is_error() ? thd->get_stmt_da()->sql_errno() :
0);
if (actual_error == 0)
{
table->file->print_error(error, MYF(0));
- actual_error= (thd->is_error() ? thd->stmt_da->sql_errno() :
+ actual_error= (thd->is_error() ? thd->get_stmt_da()->sql_errno() :
ER_UNKNOWN_ERROR);
if (actual_error == ER_UNKNOWN_ERROR)
if (global_system_variables.log_warnings)
@@ -3416,7 +3416,7 @@ START SLAVE; . Query: '%s'", expected_er
}
/* If the query was not ignored, it is printed to the general log */
- if (!thd->is_error() || thd->stmt_da->sql_errno() != ER_SLAVE_IGNORED_TABLE)
+ if (!thd->is_error() || thd->get_stmt_da()->sql_errno() != ER_SLAVE_IGNORED_TABLE)
general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
compare_errors:
@@ -3428,14 +3428,14 @@ compare_errors:
not exist errors", we silently clear the error if TEMPORARY was used.
*/
if (thd->lex->sql_command == SQLCOM_DROP_TABLE && thd->lex->drop_temporary &&
- thd->is_error() && thd->stmt_da->sql_errno() == ER_BAD_TABLE_ERROR &&
+ thd->is_error() && thd->get_stmt_da()->sql_errno() == ER_BAD_TABLE_ERROR &&
!expected_error)
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
/*
If we expected a non-zero error code, and we don't get the same error
code, and it should be ignored or is related to a concurrency issue.
*/
- actual_error= thd->is_error() ? thd->stmt_da->sql_errno() : 0;
+ actual_error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0;
DBUG_PRINT("info",("expected_error: %d sql_errno: %d",
expected_error, actual_error));
@@ -3452,7 +3452,7 @@ Error on slave: actual message='%s', err
Default database: '%s'. Query: '%s'",
ER_SAFE(expected_error),
expected_error,
- actual_error ? thd->stmt_da->message() : "no error",
+ actual_error ? thd->get_stmt_da()->message() : "no error",
actual_error,
print_slave_db_safe(db), query_arg);
thd->is_slave_error= 1;
@@ -3476,7 +3476,7 @@ Default database: '%s'. Query: '%s'",
{
rli->report(ERROR_LEVEL, actual_error,
"Error '%s' on query. Default database: '%s'. Query: '%s'",
- (actual_error ? thd->stmt_da->message() :
+ (actual_error ? thd->get_stmt_da()->message() :
"unexpected success or fatal error"),
print_slave_db_safe(thd->db), query_arg);
thd->is_slave_error= 1;
@@ -4822,7 +4822,7 @@ int Load_log_event::do_apply_event(NET*
{
thd->set_time((time_t)when);
thd->set_query_id(next_query_id());
- thd->warning_info->opt_clear_warning_info(thd->query_id);
+ thd->get_warning_info()->opt_clear_warning_info(thd->query_id);
TABLE_LIST tables;
tables.init_one_table(thd->strmake(thd->db, thd->db_length),
@@ -4966,9 +4966,9 @@ error:
thd->catalog= 0;
thd->set_db(NULL, 0); /* will free the current database */
thd->reset_query();
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
close_thread_tables(thd);
/*
- If inside a multi-statement transaction,
@@ -4995,8 +4995,8 @@ error:
int sql_errno;
if (thd->is_error())
{
- err= thd->stmt_da->message();
- sql_errno= thd->stmt_da->sql_errno();
+ err= thd->get_stmt_da()->message();
+ sql_errno= thd->get_stmt_da()->sql_errno();
}
else
{
@@ -7605,7 +7605,7 @@ int Rows_log_event::do_apply_event(Relay
if (open_and_lock_tables(thd, rli->tables_to_lock, FALSE, 0))
{
- uint actual_error= thd->stmt_da->sql_errno();
+ uint actual_error= thd->get_stmt_da()->sql_errno();
if (thd->is_slave_error || thd->is_fatal_error)
{
/*
@@ -7616,7 +7616,7 @@ int Rows_log_event::do_apply_event(Relay
*/
rli->report(ERROR_LEVEL, actual_error,
"Error executing row event: '%s'",
- (actual_error ? thd->stmt_da->message() :
+ (actual_error ? thd->get_stmt_da()->message() :
"unexpected success or fatal error"));
thd->is_slave_error= 1;
}
=== modified file 'sql/log_event_old.cc'
--- a/sql/log_event_old.cc 2010-07-15 13:47:50 +0000
+++ b/sql/log_event_old.cc 2011-05-19 10:10:49 +0000
@@ -85,7 +85,7 @@ Old_rows_log_event::do_apply_event(Old_r
if (open_and_lock_tables(ev_thd, rli->tables_to_lock, FALSE, 0))
{
- uint actual_error= ev_thd->stmt_da->sql_errno();
+ uint actual_error= ev_thd->get_stmt_da()->sql_errno();
if (ev_thd->is_slave_error || ev_thd->is_fatal_error)
{
/*
@@ -94,7 +94,7 @@ Old_rows_log_event::do_apply_event(Old_r
*/
rli->report(ERROR_LEVEL, actual_error,
"Error '%s' on opening tables",
- (actual_error ? ev_thd->stmt_da->message() :
+ (actual_error ? ev_thd->get_stmt_da()->message() :
"unexpected success or fatal error"));
ev_thd->is_slave_error= 1;
}
@@ -228,10 +228,10 @@ Old_rows_log_event::do_apply_event(Old_r
break;
default:
- rli->report(ERROR_LEVEL, ev_thd->stmt_da->sql_errno(),
+ rli->report(ERROR_LEVEL, ev_thd->get_stmt_da()->sql_errno(),
"Error in %s event: row application failed. %s",
ev->get_type_str(),
- ev_thd->is_error() ? ev_thd->stmt_da->message() : "");
+ ev_thd->is_error() ? ev_thd->get_stmt_da()->message() : "");
thd->is_slave_error= 1;
break;
}
@@ -245,12 +245,12 @@ Old_rows_log_event::do_apply_event(Old_r
if (error)
{ /* error has occured during the transaction */
- rli->report(ERROR_LEVEL, ev_thd->stmt_da->sql_errno(),
+ rli->report(ERROR_LEVEL, ev_thd->get_stmt_da()->sql_errno(),
"Error in %s event: error during transaction execution "
"on table %s.%s. %s",
ev->get_type_str(), table->s->db.str,
table->s->table_name.str,
- ev_thd->is_error() ? ev_thd->stmt_da->message() : "");
+ ev_thd->is_error() ? ev_thd->get_stmt_da()->message() : "");
/*
If one day we honour --skip-slave-errors in row-based replication, and
=== modified file 'sql/opt_sum.cc'
--- a/sql/opt_sum.cc 2011-04-15 06:54:05 +0000
+++ b/sql/opt_sum.cc 2011-05-19 10:10:49 +0000
@@ -450,7 +450,7 @@ int opt_sum_query(THD *thd,
}
if (thd->is_error())
- DBUG_RETURN(thd->stmt_da->sql_errno());
+ DBUG_RETURN(thd->get_stmt_da()->sql_errno());
/*
If we have a where clause, we can only ignore searching in the
=== modified file 'sql/protocol.cc'
--- a/sql/protocol.cc 2011-02-02 11:54:49 +0000
+++ b/sql/protocol.cc 2011-05-19 10:10:49 +0000
@@ -161,14 +161,14 @@ bool net_send_error(THD *thd, uint sql_e
It's one case when we can push an error even though there
is an OK or EOF already.
*/
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
/* Abort multi-result sets */
thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
error= net_send_error_packet(thd, sql_errno, err, sqlstate);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
DBUG_RETURN(error);
}
@@ -242,7 +242,7 @@ net_send_ok(THD *thd,
int2store(pos, server_status);
pos+=2;
}
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
if (message && message[0])
pos= net_store_data(pos, (uchar*) message, strlen(message));
@@ -251,7 +251,7 @@ net_send_ok(THD *thd,
error= net_flush(net);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
DBUG_PRINT("info", ("OK sent, so no more error sending allowed"));
DBUG_RETURN(error);
@@ -291,11 +291,11 @@ net_send_eof(THD *thd, uint server_statu
/* Set to TRUE if no active vio, to work well in case of --init-file */
if (net->vio != 0)
{
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
error= write_eof_packet(thd, net, server_status, statement_warn_count);
if (!error)
error= net_flush(net);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
DBUG_PRINT("info", ("EOF sent, so no more error sending allowed"));
}
DBUG_RETURN(error);
@@ -490,30 +490,30 @@ static uchar *net_store_length_fast(ucha
void Protocol::end_statement()
{
DBUG_ENTER("Protocol::end_statement");
- DBUG_ASSERT(! thd->stmt_da->is_sent);
+ DBUG_ASSERT(! thd->get_stmt_da()->is_sent);
bool error= FALSE;
/* Can not be true, but do not take chances in production. */
- if (thd->stmt_da->is_sent)
+ if (thd->get_stmt_da()->is_sent)
DBUG_VOID_RETURN;
- switch (thd->stmt_da->status()) {
+ switch (thd->get_stmt_da()->status()) {
case Diagnostics_area::DA_ERROR:
/* The query failed, send error to log and abort bootstrap. */
- error= send_error(thd->stmt_da->sql_errno(),
- thd->stmt_da->message(),
- thd->stmt_da->get_sqlstate());
+ error= send_error(thd->get_stmt_da()->sql_errno(),
+ thd->get_stmt_da()->message(),
+ thd->get_stmt_da()->get_sqlstate());
break;
case Diagnostics_area::DA_EOF:
error= send_eof(thd->server_status,
- thd->stmt_da->statement_warn_count());
+ thd->get_stmt_da()->statement_warn_count());
break;
case Diagnostics_area::DA_OK:
error= send_ok(thd->server_status,
- thd->stmt_da->statement_warn_count(),
- thd->stmt_da->affected_rows(),
- thd->stmt_da->last_insert_id(),
- thd->stmt_da->message());
+ thd->get_stmt_da()->statement_warn_count(),
+ thd->get_stmt_da()->affected_rows(),
+ thd->get_stmt_da()->last_insert_id(),
+ thd->get_stmt_da()->message());
break;
case Diagnostics_area::DA_DISABLED:
break;
@@ -524,7 +524,7 @@ void Protocol::end_statement()
break;
}
if (!error)
- thd->stmt_da->is_sent= TRUE;
+ thd->get_stmt_da()->is_sent= TRUE;
DBUG_VOID_RETURN;
}
@@ -642,9 +642,9 @@ bool Protocol::flush()
{
#ifndef EMBEDDED_LIBRARY
bool error;
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
error= net_flush(&thd->net);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
return error;
#else
return 0;
@@ -805,7 +805,7 @@ bool Protocol::send_result_set_metadata(
Send no warning information, as it will be sent at statement end.
*/
if (write_eof_packet(thd, &thd->net, thd->server_status,
- thd->warning_info->statement_warn_count()))
+ thd->get_warning_info()->statement_warn_count()))
DBUG_RETURN(1);
}
DBUG_RETURN(prepare_for_send(list->elements));
=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc 2011-03-01 16:39:28 +0000
+++ b/sql/rpl_rli.cc 2011-05-19 10:10:49 +0000
@@ -224,7 +224,7 @@ a file name for --relay-log-index option
{
sql_print_error("Failed to create a new relay log info file (\
file '%s', errno %d)", fname, my_errno);
- msg= current_thd->stmt_da->message();
+ msg= current_thd->get_stmt_da()->message();
goto err;
}
if (init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0,
@@ -232,7 +232,7 @@ file '%s', errno %d)", fname, my_errno);
{
sql_print_error("Failed to create a cache on relay log info file '%s'",
fname);
- msg= current_thd->stmt_da->message();
+ msg= current_thd->get_stmt_da()->message();
goto err;
}
@@ -1264,9 +1264,9 @@ void Relay_log_info::clear_tables_to_loc
void Relay_log_info::slave_close_thread_tables(THD *thd)
{
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
close_thread_tables(thd);
/*
=== modified file 'sql/slave.cc'
--- a/sql/slave.cc 2011-05-05 23:50:31 +0000
+++ b/sql/slave.cc 2011-05-19 10:10:49 +0000
@@ -2218,7 +2218,7 @@ static int has_temporary_error(THD *thd)
DBUG_ENTER("has_temporary_error");
DBUG_EXECUTE_IF("all_errors_are_temporary_errors",
- if (thd->stmt_da->is_error())
+ if (thd->get_stmt_da()->is_error())
{
thd->clear_error();
my_error(ER_LOCK_DEADLOCK, MYF(0));
@@ -2237,15 +2237,15 @@ static int has_temporary_error(THD *thd)
currently, InnoDB deadlock detected by InnoDB or lock
wait timeout (innodb_lock_wait_timeout exceeded
*/
- if (thd->stmt_da->sql_errno() == ER_LOCK_DEADLOCK ||
- thd->stmt_da->sql_errno() == ER_LOCK_WAIT_TIMEOUT)
+ if (thd->get_stmt_da()->sql_errno() == ER_LOCK_DEADLOCK ||
+ thd->get_stmt_da()->sql_errno() == ER_LOCK_WAIT_TIMEOUT)
DBUG_RETURN(1);
#ifdef HAVE_NDB_BINLOG
/*
currently temporary error set in ndbcluster
*/
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
{
@@ -3254,9 +3254,9 @@ log '%s' at position %s, relay log '%s'
if (check_temp_dir(rli->slave_patternload_file))
{
- rli->report(ERROR_LEVEL, thd->stmt_da->sql_errno(),
+ rli->report(ERROR_LEVEL, thd->get_stmt_da()->sql_errno(),
"Unable to use slave's temporary directory %s - %s",
- slave_load_tmpdir, thd->stmt_da->message());
+ slave_load_tmpdir, thd->get_stmt_da()->message());
goto err;
}
@@ -3266,7 +3266,7 @@ log '%s' at position %s, relay log '%s'
execute_init_command(thd, &opt_init_slave, &LOCK_sys_init_slave);
if (thd->is_slave_error)
{
- rli->report(ERROR_LEVEL, thd->stmt_da->sql_errno(),
+ rli->report(ERROR_LEVEL, thd->get_stmt_da()->sql_errno(),
"Slave SQL thread aborted. Can't execute init_slave query");
goto err;
}
@@ -3333,20 +3333,21 @@ log '%s' at position %s, relay log '%s'
if (thd->is_error())
{
- char const *const errmsg= thd->stmt_da->message();
+ char const *const errmsg= thd->get_stmt_da()->message();
DBUG_PRINT("info",
- ("thd->stmt_da->sql_errno()=%d; rli->last_error.number=%d",
- thd->stmt_da->sql_errno(), last_errno));
+ ("thd->get_stmt_da()->sql_errno()=%d; "
+ "rli->last_error.number=%d",
+ thd->get_stmt_da()->sql_errno(), last_errno));
if (last_errno == 0)
{
/*
This function is reporting an error which was not reported
while executing exec_relay_log_event().
*/
- rli->report(ERROR_LEVEL, thd->stmt_da->sql_errno(), "%s", errmsg);
+ rli->report(ERROR_LEVEL, thd->get_stmt_da()->sql_errno(), "%s", errmsg);
}
- else if (last_errno != thd->stmt_da->sql_errno())
+ else if (last_errno != thd->get_stmt_da()->sql_errno())
{
/*
* An error was reported while executing exec_relay_log_event()
@@ -3355,12 +3356,12 @@ log '%s' at position %s, relay log '%s'
* what caused the problem.
*/
sql_print_error("Slave (additional info): %s Error_code: %d",
- errmsg, thd->stmt_da->sql_errno());
+ errmsg, thd->get_stmt_da()->sql_errno());
}
}
/* Print any warnings issued */
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
MYSQL_ERROR *err;
/*
Added controlled slave thread cancel for replication
=== modified file 'sql/sp.cc'
--- a/sql/sp.cc 2010-11-30 17:52:38 +0000
+++ b/sql/sp.cc 2011-05-19 10:10:49 +0000
@@ -1724,7 +1724,7 @@ sp_exist_routines(THD *thd, TABLE_LIST *
&thd->sp_proc_cache, FALSE) != NULL ||
sp_find_routine(thd, TYPE_ENUM_FUNCTION, name,
&thd->sp_func_cache, FALSE) != NULL;
- thd->warning_info->clear_warning_info(thd->query_id);
+ thd->get_warning_info()->clear_warning_info(thd->query_id);
if (sp_object_found)
{
if (any)
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2011-04-15 12:02:22 +0000
+++ b/sql/sp_head.cc 2011-05-19 10:10:49 +0000
@@ -1144,14 +1144,14 @@ find_handler_after_execution(THD *thd, s
if (thd->is_error())
{
ctx->find_handler(thd,
- thd->stmt_da->sql_errno(),
- thd->stmt_da->get_sqlstate(),
+ thd->get_stmt_da()->sql_errno(),
+ thd->get_stmt_da()->get_sqlstate(),
MYSQL_ERROR::WARN_LEVEL_ERROR,
- thd->stmt_da->message());
+ thd->get_stmt_da()->message());
}
- else if (thd->warning_info->statement_warn_count())
+ else if (thd->get_warning_info()->statement_warn_count())
{
- List_iterator<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ List_iterator<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
{
@@ -1218,7 +1218,7 @@ sp_head::execute(THD *thd, bool merge_da
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
Object_creation_ctx *saved_creation_ctx;
Warning_info *saved_warning_info;
- Warning_info warning_info(thd->warning_info->warn_id(), false);
+ Warning_info warning_info(thd->get_warning_info()->warn_id(), false);
/*
Just reporting a stack overrun error
@@ -1289,9 +1289,9 @@ sp_head::execute(THD *thd, bool merge_da
old_arena= thd->stmt_arena;
/* Push a new warning information area. */
- warning_info.append_warning_info(thd, thd->warning_info);
- saved_warning_info= thd->warning_info;
- thd->warning_info= &warning_info;
+ warning_info.append_warning_info(thd, thd->get_warning_info());
+ saved_warning_info= thd->get_warning_info();
+ thd->set_warning_info(&warning_info);
/*
Switch query context. This has to be done early as this is sometimes
@@ -1391,7 +1391,7 @@ sp_head::execute(THD *thd, bool merge_da
}
/* Reset number of warnings for this query. */
- thd->warning_info->reset_for_next_command();
+ thd->get_warning_info()->reset_for_next_command();
DBUG_PRINT("execute", ("Instruction %u", ip));
@@ -1499,8 +1499,8 @@ sp_head::execute(THD *thd, bool merge_da
propagated to the caller in any case.
*/
if (err_status || merge_da_on_success)
- saved_warning_info->merge_with_routine_info(thd, thd->warning_info);
- thd->warning_info= saved_warning_info;
+ saved_warning_info->merge_with_routine_info(thd, thd->get_warning_info());
+ thd->set_warning_info(saved_warning_info);
done:
DBUG_PRINT("info", ("err_status: %d killed: %d is_slave_error: %d report_error: %d",
@@ -2132,9 +2132,9 @@ sp_head::execute_procedure(THD *thd, Lis
if (!thd->in_sub_stmt)
{
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
}
thd_proc_info(thd, "closing tables");
@@ -2970,9 +2970,9 @@ sp_lex_keeper::reset_lex_and_exec_core(T
/* Here we also commit or rollback the current statement. */
if (! thd->in_sub_stmt)
{
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
}
thd_proc_info(thd, "closing tables");
close_thread_tables(thd);
@@ -3006,9 +3006,9 @@ sp_lex_keeper::reset_lex_and_exec_core(T
open_tables stage.
*/
if (!res || !thd->is_error() ||
- (thd->stmt_da->sql_errno() != ER_CANT_REOPEN_TABLE &&
- thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE &&
- thd->stmt_da->sql_errno() != ER_UPDATE_TABLE_USED))
+ (thd->get_stmt_da()->sql_errno() != ER_CANT_REOPEN_TABLE &&
+ thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE &&
+ thd->get_stmt_da()->sql_errno() != ER_UPDATE_TABLE_USED))
thd->stmt_arena->state= Query_arena::EXECUTED;
/*
@@ -3093,7 +3093,7 @@ sp_instr_stmt::execute(THD *thd, uint *n
{
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
- if (thd->stmt_da->is_eof())
+ if (thd->get_stmt_da()->is_eof())
{
/* Finalize server status flags after executing a statement. */
thd->update_server_status();
@@ -3112,7 +3112,7 @@ sp_instr_stmt::execute(THD *thd, uint *n
thd->query_name_consts= 0;
if (!thd->is_error())
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
}
DBUG_RETURN(res || thd->is_error());
}
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2011-05-16 08:50:42 +0000
+++ b/sql/sql_acl.cc 2011-05-19 10:10:49 +0000
@@ -1146,9 +1146,9 @@ my_bool acl_reload(THD *thd)
Execution might have been interrupted; only print the error message
if an error condition has been raised.
*/
- if (thd->stmt_da->is_error())
+ if (thd->get_stmt_da()->is_error())
sql_print_error("Fatal error: Can't open and lock privilege tables: %s",
- thd->stmt_da->message());
+ thd->get_stmt_da()->message());
goto end;
}
@@ -9384,7 +9384,7 @@ acl_authenticate(THD *thd, uint connect_
sctx->external_user= my_strdup(mpvio.auth_info.external_user, MYF(0));
if (res == CR_OK_HANDSHAKE_COMPLETE)
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
else
my_ok(thd);
=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc 2011-04-15 12:02:22 +0000
+++ b/sql/sql_admin.cc 2011-05-19 10:10:49 +0000
@@ -347,13 +347,13 @@ static bool mysql_admin_table(THD* thd,
*/
Warning_info wi(thd->query_id, false);
- Warning_info *wi_saved= thd->warning_info;
+ Warning_info *wi_saved= thd->get_warning_info();
- thd->warning_info= &wi;
+ thd->set_warning_info(&wi);
open_error= open_and_lock_tables(thd, table, TRUE, 0);
- thd->warning_info= wi_saved;
+ thd->set_warning_info(wi_saved);
}
else
{
@@ -468,7 +468,7 @@ static bool mysql_admin_table(THD* thd,
if (!table->table)
{
DBUG_PRINT("admin", ("open table failed"));
- if (thd->warning_info->is_empty())
+ if (thd->get_warning_info()->is_empty())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE));
/* if it was a view will check md5 sum */
@@ -476,8 +476,8 @@ static bool mysql_admin_table(THD* thd,
view_checksum(thd, table) == HA_ADMIN_WRONG_CHECKSUM)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
- if (thd->stmt_da->is_error() &&
- table_not_corrupt_error(thd->stmt_da->sql_errno()))
+ if (thd->get_stmt_da()->is_error() &&
+ table_not_corrupt_error(thd->get_stmt_da()->sql_errno()))
result_code= HA_ADMIN_FAILED;
else
/* Default failure code is corrupt table */
@@ -525,7 +525,7 @@ static bool mysql_admin_table(THD* thd,
table->table=0; // For query cache
if (protocol->write())
goto err;
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
continue;
/* purecov: end */
}
@@ -594,8 +594,8 @@ static bool mysql_admin_table(THD* thd,
we will store the error message in a result set row
and then clear.
*/
- if (thd->stmt_da->is_ok())
- thd->stmt_da->reset_diagnostics_area();
+ if (thd->get_stmt_da()->is_ok())
+ thd->get_stmt_da()->reset_diagnostics_area();
table->table= NULL;
result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
goto send_result;
@@ -611,7 +611,7 @@ send_result:
lex->cleanup_after_one_table_open();
thd->clear_error(); // these errors shouldn't get client
{
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
{
@@ -625,7 +625,7 @@ send_result:
if (protocol->write())
goto err;
}
- thd->warning_info->clear_warning_info(thd->query_id);
+ thd->get_warning_info()->clear_warning_info(thd->query_id);
}
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
@@ -723,8 +723,8 @@ send_result_message:
we will store the error message in a result set row
and then clear.
*/
- if (thd->stmt_da->is_ok())
- thd->stmt_da->reset_diagnostics_area();
+ if (thd->get_stmt_da()->is_ok())
+ thd->get_stmt_da()->reset_diagnostics_area();
trans_commit_stmt(thd);
trans_commit(thd);
close_thread_tables(thd);
@@ -756,7 +756,7 @@ send_result_message:
DBUG_ASSERT(thd->is_error() || thd->killed);
if (thd->is_error())
{
- const char *err_msg= thd->stmt_da->message();
+ const char *err_msg= thd->get_stmt_da()->message();
if (!thd->vio_ok())
{
sql_print_error("%s", err_msg);
=== modified file 'sql/sql_audit.h'
--- a/sql/sql_audit.h 2010-12-21 12:00:26 +0000
+++ b/sql/sql_audit.h 2011-05-19 10:10:49 +0000
@@ -117,7 +117,7 @@ void mysql_audit_general(THD *thd, uint
query= thd->query_string;
user= user_buff;
userlen= make_user_name(thd, user_buff);
- rows= thd->warning_info->current_row_for_warning();
+ rows= thd->get_warning_info()->current_row_for_warning();
}
else
{
@@ -135,7 +135,7 @@ void mysql_audit_general(THD *thd, uint
#define MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT(thd) mysql_audit_notify(\
(thd), MYSQL_AUDIT_CONNECTION_CLASS, MYSQL_AUDIT_CONNECTION_CONNECT,\
- (thd)->stmt_da->is_error() ? (thd)->stmt_da->sql_errno() : 0,\
+ (thd)->get_stmt_da()->is_error() ? (thd)->get_stmt_da()->sql_errno() : 0,\
(thd)->thread_id, (thd)->security_ctx->user,\
(thd)->security_ctx->user ? strlen((thd)->security_ctx->user) : 0,\
(thd)->security_ctx->priv_user, strlen((thd)->security_ctx->priv_user),\
@@ -156,7 +156,7 @@ void mysql_audit_general(THD *thd, uint
#define MYSQL_AUDIT_NOTIFY_CONNECTION_CHANGE_USER(thd) mysql_audit_notify(\
(thd), MYSQL_AUDIT_CONNECTION_CLASS, MYSQL_AUDIT_CONNECTION_CHANGE_USER,\
- (thd)->stmt_da->is_error() ? (thd)->stmt_da->sql_errno() : 0,\
+ (thd)->get_stmt_da()->is_error() ? (thd)->get_stmt_da()->sql_errno() : 0,\
(thd)->thread_id, (thd)->security_ctx->user,\
(thd)->security_ctx->user ? strlen((thd)->security_ctx->user) : 0,\
(thd)->security_ctx->priv_user, strlen((thd)->security_ctx->priv_user),\
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2011-05-06 08:27:04 +0000
+++ b/sql/sql_base.cc 2011-05-19 10:10:49 +0000
@@ -639,8 +639,11 @@ get_table_share_with_discover(THD *thd,
@todo Rework alternative ways to deal with ER_NO_SUCH TABLE.
*/
- if (share || (thd->is_error() && thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE))
+ if (share || (thd->is_error() &&
+ thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE))
+ {
DBUG_RETURN(share);
+ }
*error= 0;
@@ -1694,7 +1697,7 @@ bool close_temporary_tables(THD *thd)
qinfo.db_len= db.length();
thd->variables.character_set_client= cs_save;
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
if ((error= (mysql_bin_log.write(&qinfo) || error)))
{
/*
@@ -1712,7 +1715,7 @@ bool close_temporary_tables(THD *thd)
sql_print_error("Failed to write the DROP statement for "
"temporary tables to binary log");
}
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
thd->variables.pseudo_thread_id= save_pseudo_thread_id;
thd->thread_specific_used= save_thread_specific_used;
@@ -4019,7 +4022,7 @@ recover_from_failed_open(THD *thd)
ha_create_table_from_engine(thd, m_failed_table->db,
m_failed_table->table_name);
- thd->warning_info->clear_warning_info(thd->query_id);
+ thd->get_warning_info()->clear_warning_info(thd->query_id);
thd->clear_error(); // Clear error message
thd->mdl_context.release_transactional_locks();
break;
=== modified file 'sql/sql_cache.cc'
--- a/sql/sql_cache.cc 2010-10-12 10:07:13 +0000
+++ b/sql/sql_cache.cc 2011-05-19 10:10:49 +0000
@@ -993,7 +993,7 @@ void Query_cache::end_of_result(THD *thd
DBUG_VOID_RETURN;
/* Ensure that only complete results are cached. */
- DBUG_ASSERT(thd->stmt_da->is_eof());
+ DBUG_ASSERT(thd->get_stmt_da()->is_eof());
if (thd->killed)
{
@@ -1756,8 +1756,8 @@ def_week_frmt: %lu, in_trans: %d, autoco
response, we can't handle it anyway.
*/
(void) trans_commit_stmt(thd);
- if (!thd->stmt_da->is_set())
- thd->stmt_da->disable_status();
+ if (!thd->get_stmt_da()->is_set())
+ thd->get_stmt_da()->disable_status();
BLOCK_UNLOCK_RD(query_block);
MYSQL_QUERY_CACHE_HIT(thd->query(), (ulong) thd->limit_found_rows);
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2011-05-18 14:17:29 +0000
+++ b/sql/sql_class.cc 2011-05-19 10:10:49 +0000
@@ -364,7 +364,7 @@ int thd_tx_isolation(const THD *thd)
extern "C"
void thd_inc_row_count(THD *thd)
{
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_warning_info()->inc_current_row_for_warning();
}
@@ -506,8 +506,6 @@ THD::THD()
first_successful_insert_id_in_cur_stmt(0),
stmt_depends_on_first_successful_insert_id_in_prev_stmt(FALSE),
examined_row_count(0),
- warning_info(&main_warning_info),
- stmt_da(&main_da),
is_fatal_error(0),
transaction_rollback_request(0),
is_fatal_sub_stmt_error(0),
@@ -521,7 +519,9 @@ THD::THD()
#if defined(ENABLED_DEBUG_SYNC)
debug_sync_control(0),
#endif /* defined(ENABLED_DEBUG_SYNC) */
- main_warning_info(0, false)
+ main_warning_info(0, false),
+ m_warning_info(&main_warning_info),
+ m_stmt_da(&main_da)
{
ulong tmp;
@@ -783,7 +783,7 @@ MYSQL_ERROR* THD::raise_condition(uint s
(level == MYSQL_ERROR::WARN_LEVEL_NOTE))
DBUG_RETURN(NULL);
- warning_info->opt_clear_warning_info(query_id);
+ m_warning_info->opt_clear_warning_info(query_id);
/*
TODO: replace by DBUG_ASSERT(sql_errno != 0) once all bugs similar to
@@ -843,10 +843,10 @@ MYSQL_ERROR* THD::raise_condition(uint s
}
else
{
- if (! stmt_da->is_error())
+ if (! m_stmt_da->is_error())
{
set_row_count_func(-1);
- stmt_da->set_error_status(this, sql_errno, msg, sqlstate);
+ m_stmt_da->set_error_status(this, sql_errno, msg, sqlstate);
}
}
}
@@ -856,7 +856,7 @@ MYSQL_ERROR* THD::raise_condition(uint s
/* When simulating OOM, skip writing to error log to avoid mtr errors */
DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_RETURN(NULL););
- cond= warning_info->push_warning(this, sql_errno, sqlstate, level, msg);
+ cond= m_warning_info->push_warning(this, sql_errno, sqlstate, level, msg);
DBUG_RETURN(cond);
}
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2011-05-18 14:17:29 +0000
+++ b/sql/sql_class.h 2011-05-19 10:10:49 +0000
@@ -1895,6 +1895,12 @@ public:
auto_inc_intervals_forced.append(next_id, ULONGLONG_MAX, 0);
}
+ inline Warning_info *get_warning_info() { return m_warning_info; }
+ inline void set_warning_info(Warning_info *wi) { m_warning_info= wi; }
+
+ inline Diagnostics_area *get_stmt_da() { return m_stmt_da; }
+ inline void set_stmt_da(Diagnostics_area *da) { m_stmt_da= da; }
+
ulonglong limit_found_rows;
private:
@@ -1969,8 +1975,6 @@ public:
table_map used_tables;
USER_CONN *user_connect;
CHARSET_INFO *db_charset;
- Warning_info *warning_info;
- Diagnostics_area *stmt_da;
#if defined(ENABLED_PROFILING)
PROFILING profiling;
#endif
@@ -2412,8 +2416,8 @@ public:
inline void clear_error()
{
DBUG_ENTER("clear_error");
- if (stmt_da->is_error())
- stmt_da->reset_diagnostics_area();
+ if (m_stmt_da->is_error())
+ m_stmt_da->reset_diagnostics_area();
is_slave_error= 0;
DBUG_VOID_RETURN;
}
@@ -2440,7 +2444,7 @@ public:
*/
inline void fatal_error()
{
- DBUG_ASSERT(stmt_da->is_error() || killed);
+ DBUG_ASSERT(m_stmt_da->is_error() || killed);
is_fatal_error= 1;
DBUG_PRINT("error",("Fatal error set"));
}
@@ -2457,7 +2461,7 @@ public:
To raise this flag, use my_error().
*/
- inline bool is_error() const { return stmt_da->is_error(); }
+ inline bool is_error() const { return m_stmt_da->is_error(); }
inline CHARSET_INFO *charset() { return variables.character_set_client; }
void update_charset();
@@ -2835,6 +2839,9 @@ private:
Warning_info main_warning_info;
Diagnostics_area main_da;
+ Warning_info *m_warning_info;
+ Diagnostics_area *m_stmt_da;
+
/**
It will be set TURE if CURRENT_USER() is called in account management
statements or default definer is set in CREATE/ALTER SP, SF, Event,
@@ -2856,24 +2863,24 @@ private:
};
-/** A short cut for thd->stmt_da->set_ok_status(). */
+/** A short cut for thd->get_stmt_da()->set_ok_status(). */
inline void
my_ok(THD *thd, ulonglong affected_rows= 0, ulonglong id= 0,
const char *message= NULL)
{
thd->set_row_count_func(affected_rows);
- thd->stmt_da->set_ok_status(thd, affected_rows, id, message);
+ thd->get_stmt_da()->set_ok_status(thd, affected_rows, id, message);
}
-/** A short cut for thd->stmt_da->set_eof_status(). */
+/** A short cut for thd->get_stmt_da()->set_eof_status(). */
inline void
my_eof(THD *thd)
{
thd->set_row_count_func(-1);
- thd->stmt_da->set_eof_status(thd);
+ thd->get_stmt_da()->set_eof_status(thd);
}
#define tmp_disable_binlog(A) \
=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc 2011-03-15 14:56:11 +0000
+++ b/sql/sql_connect.cc 2011-05-19 10:10:49 +0000
@@ -634,7 +634,8 @@ void end_connection(THD *thd)
thd->thread_id,(thd->db ? thd->db : "unconnected"),
sctx->user ? sctx->user : "unauthenticated",
sctx->host_or_ip,
- (thd->stmt_da->is_error() ? thd->stmt_da->message() :
+ (thd->get_stmt_da()->is_error() ?
+ thd->get_stmt_da()->message() :
ER(ER_UNKNOWN_ERROR)));
}
}
@@ -672,7 +673,7 @@ void prepare_new_connection_state(THD* t
thd->thread_id,(thd->db ? thd->db : "unconnected"),
sctx->user ? sctx->user : "unauthenticated",
sctx->host_or_ip, "init_connect command failed");
- sql_print_warning("%s", thd->stmt_da->message());
+ sql_print_warning("%s", thd->get_stmt_da()->message());
}
thd->proc_info=0;
thd->set_time();
=== modified file 'sql/sql_derived.cc'
--- a/sql/sql_derived.cc 2011-03-08 17:39:25 +0000
+++ b/sql/sql_derived.cc 2011-05-19 10:10:49 +0000
@@ -183,9 +183,9 @@ exit:
if (orig_table_list->view)
{
if (thd->is_error() &&
- (thd->stmt_da->sql_errno() == ER_BAD_FIELD_ERROR ||
- thd->stmt_da->sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
- thd->stmt_da->sql_errno() == ER_SP_DOES_NOT_EXIST))
+ (thd->get_stmt_da()->sql_errno() == ER_BAD_FIELD_ERROR ||
+ thd->get_stmt_da()->sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
+ thd->get_stmt_da()->sql_errno() == ER_SP_DOES_NOT_EXIST))
{
thd->clear_error();
my_error(ER_VIEW_INVALID, MYF(0), orig_table_list->db,
=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc 2011-04-15 12:02:22 +0000
+++ b/sql/sql_error.cc 2011-05-19 10:10:49 +0000
@@ -363,7 +363,7 @@ Diagnostics_area::set_ok_status(THD *thd
if (is_error() || is_disabled())
return;
- m_statement_warn_count= thd->warning_info->statement_warn_count();
+ m_statement_warn_count= thd->get_warning_info()->statement_warn_count();
m_affected_rows= affected_rows_arg;
m_last_insert_id= last_insert_id_arg;
if (message_arg)
@@ -398,7 +398,7 @@ Diagnostics_area::set_eof_status(THD *th
anyway.
*/
m_statement_warn_count= (thd->spcont ?
- 0 : thd->warning_info->statement_warn_count());
+ 0 : thd->get_warning_info()->statement_warn_count());
m_status= DA_EOF;
DBUG_VOID_RETURN;
@@ -667,7 +667,7 @@ bool mysqld_show_warnings(THD *thd, ulon
List<Item> field_list;
DBUG_ENTER("mysqld_show_warnings");
- DBUG_ASSERT(thd->warning_info->is_read_only());
+ DBUG_ASSERT(thd->get_warning_info()->is_read_only());
field_list.push_back(new Item_empty_string("Level", 7));
field_list.push_back(new Item_return_int("Code",4, MYSQL_TYPE_LONG));
@@ -685,7 +685,7 @@ bool mysqld_show_warnings(THD *thd, ulon
unit->set_limit(sel);
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
while ((err= it++))
{
/* Skip levels that the user is not interested in */
@@ -708,7 +708,7 @@ bool mysqld_show_warnings(THD *thd, ulon
}
my_eof(thd);
- thd->warning_info->set_read_only(FALSE);
+ thd->get_warning_info()->set_read_only(FALSE);
DBUG_RETURN(FALSE);
}
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2011-01-31 13:11:05 +0000
+++ b/sql/sql_insert.cc 2011-05-19 10:10:49 +0000
@@ -928,7 +928,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
error=write_record(thd, table ,&info);
if (error)
break;
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_warning_info()->inc_current_row_for_warning();
}
free_underlaid_joins(thd, &thd->lex->select_lex);
@@ -1086,11 +1086,11 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(lock_type == TL_WRITE_DELAYED) ? (ulong) 0 :
(ulong) (info.records - info.copied),
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_warning_info()->statement_warn_count());
else
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.deleted + updated),
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_warning_info()->statement_warn_count());
::my_ok(thd, info.copied + info.deleted + updated, id, buff);
}
thd->abort_on_warning= 0;
@@ -2148,10 +2148,11 @@ bool delayed_get_table(THD *thd, MDL_req
want to send "Server shutdown in progress" in the
INSERT THREAD.
*/
- if (di->thd.stmt_da->sql_errno() == ER_SERVER_SHUTDOWN)
+ if (di->thd.get_stmt_da()->sql_errno() == ER_SERVER_SHUTDOWN)
my_message(ER_QUERY_INTERRUPTED, ER(ER_QUERY_INTERRUPTED), MYF(0));
else
- my_message(di->thd.stmt_da->sql_errno(), di->thd.stmt_da->message(),
+ my_message(di->thd.get_stmt_da()->sql_errno(),
+ di->thd.get_stmt_da()->message(),
MYF(0));
}
di->unlock();
@@ -2236,10 +2237,12 @@ TABLE *Delayed_insert::get_local_table(T
killed using mysql_notify_thread_having_shared_lock() or
kill_delayed_threads_for_table().
*/
- if (!thd.is_error() || thd.stmt_da->sql_errno() == ER_SERVER_SHUTDOWN)
+ if (!thd.is_error() ||
+ thd.get_stmt_da()->sql_errno() == ER_SERVER_SHUTDOWN)
my_message(ER_QUERY_INTERRUPTED, ER(ER_QUERY_INTERRUPTED), MYF(0));
else
- my_message(thd.stmt_da->sql_errno(), thd.stmt_da->message(), MYF(0));
+ my_message(thd.get_stmt_da()->sql_errno(),
+ thd.get_stmt_da()->message(), MYF(0));
goto error;
}
}
@@ -2611,8 +2614,8 @@ pthread_handler_t handle_delayed_insert(
if (my_thread_init())
{
/* Can't use my_error since store_globals has not yet been called */
- thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES,
- ER(ER_OUT_OF_RESOURCES), NULL);
+ thd->get_stmt_da()->set_error_status(thd, ER_OUT_OF_RESOURCES,
+ ER(ER_OUT_OF_RESOURCES), NULL);
di->handler_thread_initialized= TRUE;
}
else
@@ -2622,8 +2625,8 @@ pthread_handler_t handle_delayed_insert(
if (init_thr_lock() || thd->store_globals())
{
/* Can't use my_error since store_globals has perhaps failed */
- thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES,
- ER(ER_OUT_OF_RESOURCES), NULL);
+ thd->get_stmt_da()->set_error_status(thd, ER_OUT_OF_RESOURCES,
+ ER(ER_OUT_OF_RESOURCES), NULL);
di->handler_thread_initialized= TRUE;
thd->fatal_error();
goto err;
@@ -3008,7 +3011,7 @@ bool Delayed_insert::handle_inserts(void
{
/* This should never happen */
table->file->print_error(error,MYF(0));
- sql_print_error("%s", thd.stmt_da->message());
+ sql_print_error("%s", thd.get_stmt_da()->message());
DBUG_PRINT("error", ("HA_EXTRA_NO_CACHE failed in loop"));
goto err;
}
@@ -3054,7 +3057,7 @@ bool Delayed_insert::handle_inserts(void
if ((error=table->file->extra(HA_EXTRA_NO_CACHE)))
{ // This shouldn't happen
table->file->print_error(error,MYF(0));
- sql_print_error("%s", thd.stmt_da->message());
+ sql_print_error("%s", thd.get_stmt_da()->message());
DBUG_PRINT("error", ("HA_EXTRA_NO_CACHE failed after loop"));
goto err;
}
@@ -3471,7 +3474,7 @@ bool select_insert::send_eof()
error= (thd->locked_tables_mode <= LTM_LOCK_TABLES ?
table->file->ha_end_bulk_insert() : 0);
if (!error && thd->is_error())
- error= thd->stmt_da->sql_errno();
+ error= thd->get_stmt_da()->sql_errno();
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
@@ -3525,11 +3528,11 @@ bool select_insert::send_eof()
if (info.ignore)
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.records - info.copied),
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_warning_info()->statement_warn_count());
else
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.deleted+info.updated),
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_warning_info()->statement_warn_count());
row_count= info.copied + info.deleted +
((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
info.touched : info.updated);
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2011-05-12 09:41:17 +0000
+++ b/sql/sql_load.cc 2011-05-19 10:10:49 +0000
@@ -590,7 +590,7 @@ int mysql_load(THD *thd,sql_exchange *ex
}
sprintf(name, ER(ER_LOAD_INFO), (ulong) info.records, (ulong) info.deleted,
(ulong) (info.records - info.copied),
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_warning_info()->statement_warn_count());
if (thd->transaction.stmt.modified_non_trans_table)
thd->transaction.all.modified_non_trans_table= TRUE;
@@ -835,7 +835,7 @@ read_fixed_length(THD *thd, COPY_INFO &i
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_FEW_RECORDS,
ER(ER_WARN_TOO_FEW_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
if (!field->maybe_null() && field->type() == FIELD_TYPE_TIMESTAMP)
((Field_timestamp*) field)->set_time();
}
@@ -859,7 +859,7 @@ read_fixed_length(THD *thd, COPY_INFO &i
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_MANY_RECORDS,
ER(ER_WARN_TOO_MANY_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
}
if (thd->killed ||
@@ -895,9 +895,9 @@ read_fixed_length(THD *thd, COPY_INFO &i
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_MANY_RECORDS,
ER(ER_WARN_TOO_MANY_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
}
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_warning_info()->inc_current_row_for_warning();
continue_loop:;
}
DBUG_RETURN(test(read_info.error));
@@ -961,7 +961,7 @@ read_sep_field(THD *thd, COPY_INFO &info
if (field->reset())
{
my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field->field_name,
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
DBUG_RETURN(1);
}
field->set_null();
@@ -1033,7 +1033,7 @@ read_sep_field(THD *thd, COPY_INFO &info
if (field->reset())
{
my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0),field->field_name,
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
DBUG_RETURN(1);
}
if (!field->maybe_null() && field->type() == FIELD_TYPE_TIMESTAMP)
@@ -1048,7 +1048,7 @@ read_sep_field(THD *thd, COPY_INFO &info
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_FEW_RECORDS,
ER(ER_WARN_TOO_FEW_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
}
else if (item->type() == Item::STRING_ITEM)
{
@@ -1094,11 +1094,11 @@ read_sep_field(THD *thd, COPY_INFO &info
thd->cuted_fields++; /* To long row */
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_MANY_RECORDS, ER(ER_WARN_TOO_MANY_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
if (thd->killed)
DBUG_RETURN(1);
}
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_warning_info()->inc_current_row_for_warning();
continue_loop:;
}
DBUG_RETURN(test(read_info.error));
@@ -1232,7 +1232,7 @@ read_xml_field(THD *thd, COPY_INFO &info
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_FEW_RECORDS,
ER(ER_WARN_TOO_FEW_RECORDS),
- thd->warning_info->current_row_for_warning());
+ thd->get_warning_info()->current_row_for_warning());
}
else
((Item_user_var_as_out_param *)item)->set_null_value(cs);
@@ -1263,7 +1263,7 @@ read_xml_field(THD *thd, COPY_INFO &info
its default value at the beginning of each loop iteration.
*/
thd->transaction.stmt.modified_non_trans_table= no_trans_update_stmt;
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_warning_info()->inc_current_row_for_warning();
continue_loop:;
}
DBUG_RETURN(test(read_info.error) || thd->is_error());
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2011-05-06 08:27:04 +0000
+++ b/sql/sql_parse.cc 2011-05-19 10:10:49 +0000
@@ -694,7 +694,7 @@ bool do_command(THD *thd)
Consider moving to init_connect() instead.
*/
thd->clear_error(); // Clear error message
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
net_new_transaction(net);
@@ -1183,7 +1183,7 @@ bool dispatch_command(enum enum_server_c
/* We don't calculate statistics for this command */
general_log_print(thd, command, NullS);
net->error=0; // Don't give 'abort' message
- thd->stmt_da->disable_status(); // Don't send anything back
+ thd->get_stmt_da()->disable_status(); // Don't send anything back
error=TRUE; // End server
break;
#ifndef EMBEDDED_LIBRARY
@@ -1323,7 +1323,7 @@ bool dispatch_command(enum enum_server_c
#else
(void) my_net_write(net, (uchar*) buff, length);
(void) net_flush(net);
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
#endif
break;
}
@@ -1398,7 +1398,8 @@ bool dispatch_command(enum enum_server_c
mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_RESULT, 0, 0);
mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_STATUS,
- thd->stmt_da->is_error() ? thd->stmt_da->sql_errno() : 0,
+ thd->get_stmt_da()->is_error() ?
+ thd->get_stmt_da()->sql_errno() : 0,
command_name[command].str);
log_slow_statement(thd);
@@ -1820,12 +1821,12 @@ mysql_execute_command(THD *thd)
variables, but for now this is probably good enough.
*/
if ((sql_command_flags[lex->sql_command] & CF_DIAGNOSTIC_STMT) != 0)
- thd->warning_info->set_read_only(TRUE);
+ thd->get_warning_info()->set_read_only(TRUE);
else
{
- thd->warning_info->set_read_only(FALSE);
+ thd->get_warning_info()->set_read_only(FALSE);
if (all_tables)
- thd->warning_info->opt_clear_warning_info(thd->query_id);
+ thd->get_warning_info()->opt_clear_warning_info(thd->query_id);
}
#ifdef HAVE_REPLICATION
@@ -4344,7 +4345,7 @@ finish:
/* report error issued during command execution */
if (thd->killed_errno())
{
- if (! thd->stmt_da->is_set())
+ if (! thd->get_stmt_da()->is_set())
thd->send_kill_message();
}
if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA)
@@ -4357,9 +4358,9 @@ finish:
else
{
/* If commit fails, we should be able to reset the OK status. */
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
}
}
@@ -4379,10 +4380,10 @@ finish:
/* No transaction control allowed in sub-statements. */
DBUG_ASSERT(! thd->in_sub_stmt);
/* If commit fails, we should be able to reset the OK status. */
- thd->stmt_da->can_overwrite_status= TRUE;
+ thd->get_stmt_da()->can_overwrite_status= TRUE;
/* Commit the normal transaction if one is active. */
trans_commit_implicit(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
+ thd->get_stmt_da()->can_overwrite_status= FALSE;
thd->mdl_context.release_transactional_locks();
}
else if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode())
@@ -5239,8 +5240,8 @@ void THD::reset_for_next_command()
thd->user_var_events_alloc= thd->mem_root;
}
thd->clear_error();
- thd->stmt_da->reset_diagnostics_area();
- thd->warning_info->reset_for_next_command();
+ thd->get_stmt_da()->reset_diagnostics_area();
+ thd->get_warning_info()->reset_for_next_command();
thd->rand_used= 0;
thd->sent_row_count= thd->examined_row_count= 0;
=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc 2011-04-15 12:02:22 +0000
+++ b/sql/sql_prepare.cc 2011-05-19 10:10:49 +0000
@@ -339,7 +339,7 @@ static bool send_prep_stmt(Prepared_stat
int2store(buff+5, columns);
int2store(buff+7, stmt->param_count);
buff[9]= 0; // Guard against a 4.1 client
- tmp= min(stmt->thd->warning_info->statement_warn_count(), 65535);
+ tmp= min(stmt->thd->get_warning_info()->statement_warn_count(), 65535);
int2store(buff+10, tmp);
/*
@@ -356,7 +356,7 @@ static bool send_prep_stmt(Prepared_stat
if (!error)
/* Flag that a response has already been sent */
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
DBUG_RETURN(error);
}
@@ -369,7 +369,7 @@ static bool send_prep_stmt(Prepared_stat
thd->client_stmt_id= stmt->id;
thd->client_param_count= stmt->param_count;
thd->clear_error();
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
return 0;
}
@@ -1961,7 +1961,7 @@ static bool check_prepared_statement(Pre
/* Reset warning count for each query that uses tables */
if (tables)
- thd->warning_info->opt_clear_warning_info(thd->query_id);
+ thd->get_warning_info()->opt_clear_warning_info(thd->query_id);
switch (sql_command) {
case SQLCOM_REPLACE:
@@ -2736,7 +2736,7 @@ void mysqld_stmt_close(THD *thd, char *p
Prepared_statement *stmt;
DBUG_ENTER("mysqld_stmt_close");
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
if (!(stmt= find_prepared_statement(thd, stmt_id)))
DBUG_VOID_RETURN;
@@ -2812,7 +2812,7 @@ void mysql_stmt_get_longdata(THD *thd, c
status_var_increment(thd->status_var.com_stmt_send_long_data);
- thd->stmt_da->disable_status();
+ thd->get_stmt_da()->disable_status();
#ifndef EMBEDDED_LIBRARY
/* Minimal size of long data packet is 6 bytes */
if (packet_length < MYSQL_LONG_DATA_HEADER)
@@ -2841,26 +2841,26 @@ void mysql_stmt_get_longdata(THD *thd, c
param= stmt->param_array[param_number];
- Diagnostics_area new_stmt_da, *save_stmt_da= thd->stmt_da;
+ Diagnostics_area new_stmt_da, *save_stmt_da= thd->get_stmt_da();
Warning_info new_warnning_info(thd->query_id, false);
- Warning_info *save_warinig_info= thd->warning_info;
+ Warning_info *save_warinig_info= thd->get_warning_info();
- thd->stmt_da= &new_stmt_da;
- thd->warning_info= &new_warnning_info;
+ thd->set_stmt_da(&new_stmt_da);
+ thd->set_warning_info(&new_warnning_info);
#ifndef EMBEDDED_LIBRARY
param->set_longdata(packet, (ulong) (packet_end - packet));
#else
param->set_longdata(thd->extra_data, thd->extra_length);
#endif
- if (thd->stmt_da->is_error())
+ if (thd->get_stmt_da()->is_error())
{
stmt->state= Query_arena::ERROR;
- stmt->last_errno= thd->stmt_da->sql_errno();
- strncpy(stmt->last_error, thd->stmt_da->message(), MYSQL_ERRMSG_SIZE);
+ stmt->last_errno= thd->get_stmt_da()->sql_errno();
+ strncpy(stmt->last_error, thd->get_stmt_da()->message(), MYSQL_ERRMSG_SIZE);
}
- thd->stmt_da= save_stmt_da;
- thd->warning_info= save_warinig_info;
+ thd->set_stmt_da(save_stmt_da);
+ thd->set_warning_info(save_warinig_info);
general_log_print(thd, thd->command, NullS);
@@ -2936,8 +2936,8 @@ Reprepare_observer::report_error(THD *th
that this thread execution stops and returns to the caller,
backtracking all the way to Prepared_statement::execute_loop().
*/
- thd->stmt_da->set_error_status(thd, ER_NEED_REPREPARE,
- ER(ER_NEED_REPREPARE), "HY000");
+ thd->get_stmt_da()->set_error_status(thd, ER_NEED_REPREPARE,
+ ER(ER_NEED_REPREPARE), "HY000");
m_invalidated= TRUE;
return TRUE;
@@ -3441,7 +3441,7 @@ reexecute:
reprepare_observer.is_invalidated() &&
reprepare_attempt++ < MAX_REPREPARE_ATTEMPTS)
{
- DBUG_ASSERT(thd->stmt_da->sql_errno() == ER_NEED_REPREPARE);
+ DBUG_ASSERT(thd->get_stmt_da()->sql_errno() == ER_NEED_REPREPARE);
thd->clear_error();
error= reprepare();
@@ -3543,7 +3543,7 @@ Prepared_statement::reprepare()
Sic: we can't simply silence warnings during reprepare, because if
it's failed, we need to return all the warnings to the user.
*/
- thd->warning_info->clear_warning_info(thd->query_id);
+ thd->get_warning_info()->clear_warning_info(thd->query_id);
}
return error;
}
@@ -3964,23 +3964,23 @@ bool Ed_connection::execute_direct(Serve
Protocol_local protocol_local(m_thd, this);
Prepared_statement stmt(m_thd);
Protocol *save_protocol= m_thd->protocol;
- Diagnostics_area *save_diagnostics_area= m_thd->stmt_da;
- Warning_info *save_warning_info= m_thd->warning_info;
+ Diagnostics_area *save_diagnostics_area= m_thd->get_stmt_da();
+ Warning_info *save_warning_info= m_thd->get_warning_info();
DBUG_ENTER("Ed_connection::execute_direct");
free_old_result(); /* Delete all data from previous execution, if any */
m_thd->protocol= &protocol_local;
- m_thd->stmt_da= &m_diagnostics_area;
- m_thd->warning_info= &m_warning_info;
+ m_thd->set_stmt_da(&m_diagnostics_area);
+ m_thd->set_warning_info(&m_warning_info);
rc= stmt.execute_server_runnable(server_runnable);
m_thd->protocol->end_statement();
m_thd->protocol= save_protocol;
- m_thd->stmt_da= save_diagnostics_area;
- m_thd->warning_info= save_warning_info;
+ m_thd->set_stmt_da(save_diagnostics_area);
+ m_thd->set_warning_info(save_warning_info);
/*
Protocol_local makes use of m_current_rset to keep
track of the last result set, while adding result sets to the end.
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2011-05-06 08:27:04 +0000
+++ b/sql/sql_select.cc 2011-05-19 10:10:49 +0000
@@ -11695,7 +11695,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab
/* Set first_unmatched for the last inner table of this group */
join_tab->last_inner->first_unmatched= join_tab;
}
- join->thd->warning_info->reset_current_row_for_warning();
+ join->thd->get_warning_info()->reset_current_row_for_warning();
error= (*join_tab->read_first_record)(join_tab);
rc= evaluate_join_record(join, join_tab, error);
@@ -11846,7 +11846,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
enum enum_nested_loop_state rc;
/* A match from join_tab is found for the current partial join. */
rc= (*join_tab->next_select)(join, join_tab+1, 0);
- join->thd->warning_info->inc_current_row_for_warning();
+ join->thd->get_warning_info()->inc_current_row_for_warning();
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
return rc;
if (join->return_tab < join_tab)
@@ -11861,7 +11861,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
}
else
{
- join->thd->warning_info->inc_current_row_for_warning();
+ join->thd->get_warning_info()->inc_current_row_for_warning();
join_tab->read_record.unlock_row(join_tab);
}
}
@@ -11872,7 +11872,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
with the beginning coinciding with the current partial join.
*/
join->examined_rows++;
- join->thd->warning_info->inc_current_row_for_warning();
+ join->thd->get_warning_info()->inc_current_row_for_warning();
join_tab->read_record.unlock_row(join_tab);
}
return NESTED_LOOP_OK;
=== modified file 'sql/sql_servers.cc'
--- a/sql/sql_servers.cc 2010-08-12 16:44:41 +0000
+++ b/sql/sql_servers.cc 2011-05-19 10:10:49 +0000
@@ -264,9 +264,9 @@ bool servers_reload(THD *thd)
Execution might have been interrupted; only print the error message
if an error condition has been raised.
*/
- if (thd->stmt_da->is_error())
+ if (thd->get_stmt_da()->is_error())
sql_print_error("Can't open and lock privilege tables: %s",
- thd->stmt_da->message());
+ thd->get_stmt_da()->message());
return_val= FALSE;
goto end;
}
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2011-04-15 12:02:22 +0000
+++ b/sql/sql_show.cc 2011-05-19 10:10:49 +0000
@@ -3115,7 +3115,7 @@ static int fill_schema_table_names(THD *
default:
DBUG_ASSERT(0);
}
- if (thd->is_error() && thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
+ if (thd->is_error() && thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE)
{
thd->clear_error();
return 0;
@@ -3705,10 +3705,10 @@ int get_all_tables(THD *thd, TABLE_LIST
can return an error without setting an error message
in THD, which is a hack. This is why we have to
check for res, then for thd->is_error() only then
- for thd->stmt_da->sql_errno().
+ for thd->get_stmt_da()->sql_errno().
*/
if (res && thd->is_error() &&
- thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
+ thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE)
{
/*
Hide error for not existing table.
@@ -4079,13 +4079,13 @@ err:
column with the error text, and clear the error so that the operation
can continue.
*/
- const char *error= thd->is_error() ? thd->stmt_da->message() : "";
+ const char *error= thd->is_error() ? thd->get_stmt_da()->message() : "";
table->field[20]->store(error, strlen(error), cs);
if (thd->is_error())
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
}
}
@@ -4242,7 +4242,7 @@ static int get_schema_column_record(THD
*/
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
res= 0;
}
@@ -4903,7 +4903,7 @@ static int get_schema_stat_record(THD *t
*/
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
res= 0;
}
@@ -5122,7 +5122,7 @@ static int get_schema_views_record(THD *
DBUG_RETURN(1);
if (res && thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
}
if (res)
thd->clear_error();
@@ -5156,7 +5156,7 @@ static int get_schema_constraints_record
{
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
DBUG_RETURN(0);
}
@@ -5262,7 +5262,7 @@ static int get_schema_triggers_record(TH
{
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
DBUG_RETURN(0);
}
@@ -5343,7 +5343,7 @@ static int get_schema_key_column_usage_r
{
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
DBUG_RETURN(0);
}
@@ -5633,7 +5633,7 @@ static int get_schema_partitions_record(
{
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
DBUG_RETURN(0);
}
@@ -6162,7 +6162,7 @@ get_referential_constraints_record(THD *
{
if (thd->is_error())
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->stmt_da->sql_errno(), thd->stmt_da->message());
+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
thd->clear_error();
DBUG_RETURN(0);
}
@@ -6774,24 +6774,24 @@ static bool do_fill_table(THD *thd,
// that problem we create a Warning_info instance, which is capable of
// storing "unlimited" number of warnings.
Warning_info wi(thd->query_id, true);
- Warning_info *wi_saved= thd->warning_info;
+ Warning_info *wi_saved= thd->get_warning_info();
- thd->warning_info= &wi;
+ thd->set_warning_info(&wi);
bool res= table_list->schema_table->fill_table(
thd, table_list, join_table->select_cond);
- thd->warning_info= wi_saved;
+ thd->set_warning_info(wi_saved);
// Pass an error if any.
- if (thd->stmt_da->is_error())
+ if (thd->get_stmt_da()->is_error())
{
- thd->warning_info->push_warning(thd,
- thd->stmt_da->sql_errno(),
- thd->stmt_da->get_sqlstate(),
- MYSQL_ERROR::WARN_LEVEL_ERROR,
- thd->stmt_da->message());
+ thd->get_warning_info()->push_warning(thd,
+ thd->get_stmt_da()->sql_errno(),
+ thd->get_stmt_da()->get_sqlstate(),
+ MYSQL_ERROR::WARN_LEVEL_ERROR,
+ thd->get_stmt_da()->message());
}
// Pass warnings (if any).
@@ -6806,7 +6806,7 @@ static bool do_fill_table(THD *thd,
while ((err= it++))
{
if (err->get_level() != MYSQL_ERROR::WARN_LEVEL_ERROR)
- thd->warning_info->push_warning(thd, err);
+ thd->get_warning_info()->push_warning(thd, err);
}
return res;
=== modified file 'sql/sql_signal.cc'
--- a/sql/sql_signal.cc 2010-07-30 15:28:36 +0000
+++ b/sql/sql_signal.cc 2011-05-19 10:10:49 +0000
@@ -466,9 +466,9 @@ bool Signal_statement::execute(THD *thd)
This has roots in the SQL standard specification for SIGNAL.
*/
- thd->stmt_da->reset_diagnostics_area();
+ thd->get_stmt_da()->reset_diagnostics_area();
thd->set_row_count_func(0);
- thd->warning_info->clear_warning_info(thd->query_id);
+ thd->get_warning_info()->clear_warning_info(thd->query_id);
result= raise_condition(thd, &cond);
@@ -483,7 +483,7 @@ bool Resignal_statement::execute(THD *th
DBUG_ENTER("Resignal_statement::execute");
- thd->warning_info->m_warn_id= thd->query_id;
+ thd->get_warning_info()->m_warn_id= thd->query_id;
if (! thd->spcont || ! (signaled= thd->spcont->raised_condition()))
{
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2011-05-06 08:27:04 +0000
+++ b/sql/sql_table.cc 2011-05-19 10:10:49 +0000
@@ -2747,7 +2747,7 @@ CHARSET_INFO* get_sql_field_charset(Crea
bool check_duplicate_warning(THD *thd, char *msg, ulong length)
{
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
{
@@ -6751,7 +6751,7 @@ bool mysql_alter_table(THD *thd,char *ne
end_temporary:
my_snprintf(tmp_name, sizeof(tmp_name), ER(ER_INSERT_INFO),
(ulong) (copied + deleted), (ulong) deleted,
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_warning_info()->statement_warn_count());
my_ok(thd, copied + deleted, 0L, tmp_name);
DBUG_RETURN(FALSE);
@@ -6778,7 +6778,7 @@ err:
Report error here.
*/
if (alter_info->error_if_not_empty &&
- thd->warning_info->current_row_for_warning())
+ thd->get_warning_info()->current_row_for_warning())
{
const char *f_val= 0;
enum enum_mysql_timestamp_type t_type= MYSQL_TIMESTAMP_DATE;
@@ -6981,7 +6981,7 @@ copy_data_between_tables(TABLE *from,TAB
init_read_record(&info, thd, from, (SQL_SELECT *) 0, 1, 1, FALSE);
if (ignore)
to->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
- thd->warning_info->reset_current_row_for_warning();
+ thd->get_warning_info()->reset_current_row_for_warning();
restore_record(to, s->default_values); // Create empty record
while (!(error=info.read_record(&info)))
{
@@ -7040,7 +7040,7 @@ copy_data_between_tables(TABLE *from,TAB
}
else
found_count++;
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_warning_info()->inc_current_row_for_warning();
}
end_read_record(&info);
free_io_cache(from);
=== modified file 'sql/sql_time.cc'
--- a/sql/sql_time.cc 2010-03-31 14:05:33 +0000
+++ b/sql/sql_time.cc 2011-05-19 10:10:49 +0000
@@ -817,7 +817,7 @@ void make_truncated_value_warning(THD *t
cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff),
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
type_str, str.c_ptr(), field_name,
- (ulong) thd->warning_info->current_row_for_warning());
+ (ulong) thd->get_warning_info()->current_row_for_warning());
else
{
if (time_type > MYSQL_TIMESTAMP_ERROR)
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2011-02-21 15:49:03 +0000
+++ b/sql/sql_update.cc 2011-05-19 10:10:49 +0000
@@ -791,7 +791,7 @@ int mysql_update(THD *thd,
}
else
table->file->unlock_row();
- thd->warning_info->inc_current_row_for_warning();
+ thd->get_warning_info()->inc_current_row_for_warning();
if (thd->is_error())
{
error= 1;
@@ -899,7 +899,7 @@ int mysql_update(THD *thd,
char buff[MYSQL_ERRMSG_SIZE];
my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found,
(ulong) updated,
- (ulong) thd->warning_info->statement_warn_count());
+ (ulong) thd->get_warning_info()->statement_warn_count());
my_ok(thd, (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated,
id, buff);
DBUG_PRINT("info",("%ld records updated", (long) updated));
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2011-03-25 12:55:22 +0000
+++ b/sql/sys_vars.cc 2011-05-19 10:10:49 +0000
@@ -2614,7 +2614,7 @@ static Sys_var_session_special Sys_rand_
static ulonglong read_error_count(THD *thd)
{
- return thd->warning_info->error_count();
+ return thd->get_warning_info()->error_count();
}
// this really belongs to the SHOW STATUS
static Sys_var_session_special Sys_error_count(
@@ -2626,7 +2626,7 @@ static Sys_var_session_special Sys_error
static ulonglong read_warning_count(THD *thd)
{
- return thd->warning_info->warn_count();
+ return thd->get_warning_info()->warn_count();
}
// this really belongs to the SHOW STATUS
static Sys_var_session_special Sys_warning_count(
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2011-03-25 14:03:44 +0000
+++ b/sql/table.cc 2011-05-19 10:10:49 +0000
@@ -3792,20 +3792,20 @@ void TABLE_LIST::hide_view_error(THD *th
/* Hide "Unknown column" or "Unknown function" error */
DBUG_ASSERT(thd->is_error());
- if (thd->stmt_da->sql_errno() == ER_BAD_FIELD_ERROR ||
- thd->stmt_da->sql_errno() == ER_SP_DOES_NOT_EXIST ||
- thd->stmt_da->sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
- thd->stmt_da->sql_errno() == ER_PROCACCESS_DENIED_ERROR ||
- thd->stmt_da->sql_errno() == ER_COLUMNACCESS_DENIED_ERROR ||
- thd->stmt_da->sql_errno() == ER_TABLEACCESS_DENIED_ERROR ||
- thd->stmt_da->sql_errno() == ER_TABLE_NOT_LOCKED ||
- thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
+ if (thd->get_stmt_da()->sql_errno() == ER_BAD_FIELD_ERROR ||
+ thd->get_stmt_da()->sql_errno() == ER_SP_DOES_NOT_EXIST ||
+ thd->get_stmt_da()->sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
+ thd->get_stmt_da()->sql_errno() == ER_PROCACCESS_DENIED_ERROR ||
+ thd->get_stmt_da()->sql_errno() == ER_COLUMNACCESS_DENIED_ERROR ||
+ thd->get_stmt_da()->sql_errno() == ER_TABLEACCESS_DENIED_ERROR ||
+ thd->get_stmt_da()->sql_errno() == ER_TABLE_NOT_LOCKED ||
+ thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE)
{
TABLE_LIST *top= top_table();
thd->clear_error();
my_error(ER_VIEW_INVALID, MYF(0), top->view_db.str, top->view_name.str);
}
- else if (thd->stmt_da->sql_errno() == ER_NO_DEFAULT_FOR_FIELD)
+ else if (thd->get_stmt_da()->sql_errno() == ER_NO_DEFAULT_FOR_FIELD)
{
TABLE_LIST *top= top_table();
thd->clear_error();
=== modified file 'sql/thr_malloc.cc'
--- a/sql/thr_malloc.cc 2010-06-11 13:48:24 +0000
+++ b/sql/thr_malloc.cc 2011-05-19 10:10:49 +0000
@@ -45,10 +45,10 @@ extern "C" {
returned in the error packet.
- SHOW ERROR/SHOW WARNINGS may be empty.
*/
- thd->stmt_da->set_error_status(thd,
- ER_OUT_OF_RESOURCES,
- ER(ER_OUT_OF_RESOURCES),
- NULL);
+ thd->get_stmt_da()->set_error_status(thd,
+ ER_OUT_OF_RESOURCES,
+ ER(ER_OUT_OF_RESOURCES),
+ NULL);
}
}
=== modified file 'sql/transaction.cc'
--- a/sql/transaction.cc 2011-04-14 08:13:28 +0000
+++ b/sql/transaction.cc 2011-05-19 10:10:49 +0000
@@ -756,7 +756,7 @@ bool trans_xa_rollback(THD *thd)
ha_commit_or_rollback_by_xid(thd->lex->xid, 0);
xid_cache_delete(xs);
}
- DBUG_RETURN(thd->stmt_da->is_error());
+ DBUG_RETURN(thd->get_stmt_da()->is_error());
}
if (xa_state != XA_IDLE && xa_state != XA_PREPARED && xa_state != XA_ROLLBACK_ONLY)
=== modified file 'sql/tztime.cc'
--- a/sql/tztime.cc 2010-08-15 07:56:14 +0000
+++ b/sql/tztime.cc 2011-05-19 10:10:49 +0000
@@ -1678,7 +1678,7 @@ my_tz_init(THD *org_thd, const char *def
MYSQL_OPEN_IGNORE_FLUSH | MYSQL_LOCK_IGNORE_TIMEOUT))
{
sql_print_warning("Can't open and lock time zone table: %s "
- "trying to live without them", thd->stmt_da->message());
+ "trying to live without them", thd->get_stmt_da()->message());
/* We will try emulate that everything is ok */
return_val= time_zone_tables_exist= 0;
goto end_with_setting_default_tz;
Attachment: [text/bzr-bundle] bzr/alexander.nozdrin@oracle.com-20110519101049-y86nho7b8rn8b21q.bundle
| Thread |
|---|
| • bzr commit into mysql-5.5 branch (alexander.nozdrin:3388) Bug#11763162 | Alexander Nozdrin | 19 May |