#At file:///home/alik/MySQL/bzr/00/bug55843/mysql-trunk-bug55843-01/ based on revid:alexander.nozdrin@stripped
3169 Alexander Nozdrin 2011-06-07
Pre-requisite patch for Bug#11763162 (55843 - Handled condition
appears as not handled).
The patch:
- Removes THD::get_warning_info();
- Creates facade of Warning_info in Diagnostics_area.
modified:
sql/event_scheduler.cc
sql/field.cc
sql/ha_ndbcluster_binlog.cc
sql/log_event.cc
sql/protocol.cc
sql/rpl_slave.cc
sql/sp.cc
sql/sp_head.cc
sql/sql_admin.cc
sql/sql_audit.h
sql/sql_base.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_error.cc
sql/sql_error.h
sql/sql_insert.cc
sql/sql_load.cc
sql/sql_parse.cc
sql/sql_prepare.cc
sql/sql_select.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
=== modified file 'sql/event_scheduler.cc'
--- a/sql/event_scheduler.cc 2011-06-07 13:09:47 +0000
+++ b/sql/event_scheduler.cc 2011-06-07 16:20:10 +0000
@@ -77,7 +77,7 @@ Event_worker_thread::print_warnings(THD
{
MYSQL_ERROR *err;
DBUG_ENTER("evex_print_warnings");
- if (thd->get_warning_info()->is_empty())
+ if (thd->get_stmt_da()->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->get_warning_info()->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_stmt_da()->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-06-07 13:09:47 +0000
+++ b/sql/field.cc 2011-06-07 16:20:10 +0000
@@ -1163,7 +1163,7 @@ int Field_num::check_int(const CHARSET_I
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"integer", err.ptr(), field_name,
- (ulong) table->in_use->get_warning_info()->
+ (ulong) table->in_use->get_stmt_da()->
current_row_for_warning());
return 1;
}
@@ -2649,7 +2649,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->get_warning_info()->
+ (ulong) table->in_use->get_stmt_da()->
current_row_for_warning());
DBUG_RETURN(err);
@@ -2670,7 +2670,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->get_warning_info()->
+ (ulong) table->in_use->get_stmt_da()->
current_row_for_warning());
my_decimal_set_zero(&decimal_value);
break;
@@ -5233,7 +5233,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->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
return 1;
}
return Field_time::get_time(ltime);
@@ -6232,7 +6232,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->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
return TRUE;
}
@@ -10080,7 +10080,7 @@ Field::set_warning(MYSQL_ERROR::enum_war
{
thd->cuted_fields+= cuted_increment;
push_warning_printf(thd, level, code, ER(code), field_name,
- thd->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
return 0;
}
return level >= MYSQL_ERROR::WARN_LEVEL_WARN;
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2011-06-07 13:09:47 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-06-07 16:20:10 +0000
@@ -982,7 +982,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->get_warning_info()->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_stmt_da()->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
sql_print_warning("NDB Binlog: (%d)%s", err->get_sql_errno(),
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2011-06-07 13:09:47 +0000
+++ b/sql/log_event.cc 2011-06-07 16:20:10 +0000
@@ -208,7 +208,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->get_warning_info()->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_stmt_da()->warn_list());
MYSQL_ERROR *err;
buff[0]= 0;
@@ -5300,7 +5300,7 @@ int Load_log_event::do_apply_event(NET*
{
thd->set_time((time_t)when);
thd->set_query_id(next_query_id());
- thd->get_warning_info()->opt_clear_warning_info(thd->query_id);
+ thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
TABLE_LIST tables;
char table_buf[NAME_LEN + 1];
=== modified file 'sql/protocol.cc'
--- a/sql/protocol.cc 2011-06-07 16:14:06 +0000
+++ b/sql/protocol.cc 2011-06-07 16:20:10 +0000
@@ -802,7 +802,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->get_warning_info()->statement_warn_count()))
+ thd->get_stmt_da()->statement_warn_count()))
DBUG_RETURN(1);
}
DBUG_RETURN(prepare_for_send(list->elements));
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc 2011-06-07 13:09:47 +0000
+++ b/sql/rpl_slave.cc 2011-06-07 16:20:10 +0000
@@ -3747,7 +3747,7 @@ log '%s' at position %s, relay log '%s'
}
/* Print any warnings issued */
- List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_stmt_da()->warn_list());
MYSQL_ERROR *err;
/*
Added controlled slave thread cancel for replication
=== modified file 'sql/sp.cc'
--- a/sql/sp.cc 2011-06-07 13:09:47 +0000
+++ b/sql/sp.cc 2011-06-07 16:20:10 +0000
@@ -1727,7 +1727,7 @@ sp_exist_routines(THD *thd, TABLE_LIST *
sp_find_routine(thd, TYPE_ENUM_FUNCTION,
name, &thd->sp_func_cache,
FALSE) != NULL;
- thd->get_warning_info()->clear_warning_info(thd->query_id);
+ thd->get_stmt_da()->clear_warning_info(thd->query_id);
if (! sp_object_found)
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION or PROCEDURE",
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2011-06-07 13:29:37 +0000
+++ b/sql/sp_head.cc 2011-06-07 16:20:10 +0000
@@ -1146,9 +1146,9 @@ find_handler_after_execution(THD *thd, s
MYSQL_ERROR::WARN_LEVEL_ERROR,
thd->get_stmt_da()->message());
}
- else if (thd->get_warning_info()->statement_warn_count())
+ else if (thd->get_stmt_da()->statement_warn_count())
{
- List_iterator<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
+ List_iterator<MYSQL_ERROR> it(thd->get_stmt_da()->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
{
@@ -1215,7 +1215,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->get_warning_info()->warn_id(), false);
+ Warning_info warning_info(thd->get_stmt_da()->warn_id(), false);
/*
Just reporting a stack overrun error
@@ -1286,8 +1286,8 @@ 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->get_warning_info());
- saved_warning_info= thd->get_warning_info();
+ saved_warning_info= thd->get_stmt_da()->get_warning_info();
+ warning_info.append_warning_info(thd, saved_warning_info);
thd->get_stmt_da()->set_warning_info(&warning_info);
/*
@@ -1388,7 +1388,7 @@ sp_head::execute(THD *thd, bool merge_da
}
/* Reset number of warnings for this query. */
- thd->get_warning_info()->reset_for_next_command();
+ thd->get_stmt_da()->reset_for_next_command();
DBUG_PRINT("execute", ("Instruction %u", ip));
@@ -1496,7 +1496,10 @@ 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->get_warning_info());
+ {
+ saved_warning_info->merge_with_routine_info(
+ thd, thd->get_stmt_da()->get_warning_info());
+ }
thd->get_stmt_da()->set_warning_info(saved_warning_info);
done:
=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc 2011-06-07 13:29:37 +0000
+++ b/sql/sql_admin.cc 2011-06-07 16:20:10 +0000
@@ -353,7 +353,7 @@ static bool mysql_admin_table(THD* thd,
Diagnostics_area *da= thd->get_stmt_da();
Warning_info wi(thd->query_id, false);
- Warning_info *wi_saved= thd->get_warning_info();
+ Warning_info *wi_saved= da->get_warning_info();
da->set_warning_info(&wi);
@@ -480,7 +480,7 @@ static bool mysql_admin_table(THD* thd,
if (!table->table)
{
DBUG_PRINT("admin", ("open table failed"));
- if (thd->get_warning_info()->is_empty())
+ if (thd->get_stmt_da()->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 */
@@ -639,7 +639,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->get_warning_info()->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_stmt_da()->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
{
@@ -653,7 +653,7 @@ send_result:
if (protocol->write())
goto err;
}
- thd->get_warning_info()->clear_warning_info(thd->query_id);
+ thd->get_stmt_da()->clear_warning_info(thd->query_id);
}
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
=== modified file 'sql/sql_audit.h'
--- a/sql/sql_audit.h 2011-06-07 13:09:47 +0000
+++ b/sql/sql_audit.h 2011-06-07 16:20:10 +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->get_warning_info()->current_row_for_warning();
+ rows= thd->get_stmt_da()->current_row_for_warning();
}
else
{
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2011-06-07 13:09:47 +0000
+++ b/sql/sql_base.cc 2011-06-07 16:20:10 +0000
@@ -4016,7 +4016,7 @@ recover_from_failed_open(THD *thd)
ha_create_table_from_engine(thd, m_failed_table->db,
m_failed_table->table_name);
- thd->get_warning_info()->clear_warning_info(thd->query_id);
+ thd->get_stmt_da()->clear_warning_info(thd->query_id);
thd->clear_error(); // Clear error message
thd->mdl_context.release_transactional_locks();
break;
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2011-06-07 13:29:37 +0000
+++ b/sql/sql_class.cc 2011-06-07 16:20:10 +0000
@@ -596,7 +596,7 @@ int thd_tx_isolation(const THD *thd)
extern "C"
void thd_inc_row_count(THD *thd)
{
- thd->get_warning_info()->inc_current_row_for_warning();
+ thd->get_stmt_da()->inc_current_row_for_warning();
}
@@ -1016,7 +1016,7 @@ MYSQL_ERROR* THD::raise_condition(uint s
(level == MYSQL_ERROR::WARN_LEVEL_NOTE))
DBUG_RETURN(NULL);
- get_warning_info()->opt_clear_warning_info(query_id);
+ get_stmt_da()->opt_clear_warning_info(query_id);
/*
TODO: replace by DBUG_ASSERT(sql_errno != 0) once all bugs similar to
@@ -1089,7 +1089,9 @@ 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= get_warning_info()->push_warning(this, sql_errno, sqlstate, level, msg);
+ cond= m_stmt_da->get_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-06-07 13:29:37 +0000
+++ b/sql/sql_class.h 2011-06-07 16:20:10 +0000
@@ -2178,9 +2178,6 @@ public:
auto_inc_intervals_forced.append(next_id, ULONGLONG_MAX, 0);
}
- inline Warning_info *get_warning_info()
- { return get_stmt_da()->get_warning_info(); }
-
inline Diagnostics_area *get_stmt_da() { return m_stmt_da; }
inline void set_stmt_da(Diagnostics_area *da) { m_stmt_da= da; }
=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc 2011-06-07 16:14:06 +0000
+++ b/sql/sql_error.cc 2011-06-07 16:20:10 +0000
@@ -372,7 +372,7 @@ Diagnostics_area::set_ok_status(THD *thd
if (is_error() || is_disabled())
return;
- m_da_statement_warn_count= thd->get_warning_info()->statement_warn_count();
+ m_da_statement_warn_count= thd->get_stmt_da()->statement_warn_count();
m_affected_rows= affected_rows_arg;
m_last_insert_id= last_insert_id_arg;
if (message_arg)
@@ -407,7 +407,7 @@ Diagnostics_area::set_eof_status(THD *th
anyway.
*/
m_da_statement_warn_count= (thd->spcont ?
- 0 : thd->get_warning_info()->statement_warn_count());
+ 0 : thd->get_stmt_da()->statement_warn_count());
m_status= DA_EOF;
DBUG_VOID_RETURN;
@@ -676,7 +676,7 @@ bool mysqld_show_warnings(THD *thd, ulon
List<Item> field_list;
DBUG_ENTER("mysqld_show_warnings");
- DBUG_ASSERT(thd->get_warning_info()->is_read_only());
+ DBUG_ASSERT(thd->get_stmt_da()->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));
@@ -694,7 +694,7 @@ bool mysqld_show_warnings(THD *thd, ulon
unit->set_limit(sel);
- List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_stmt_da()->warn_list());
while ((err= it++))
{
/* Skip levels that the user is not interested in */
@@ -717,7 +717,7 @@ bool mysqld_show_warnings(THD *thd, ulon
}
my_eof(thd);
- thd->get_warning_info()->set_read_only(FALSE);
+ thd->get_stmt_da()->set_read_only(FALSE);
DBUG_RETURN(FALSE);
}
=== modified file 'sql/sql_error.h'
--- a/sql/sql_error.h 2011-06-07 16:14:06 +0000
+++ b/sql/sql_error.h 2011-06-07 16:20:10 +0000
@@ -384,6 +384,7 @@ private:
bool m_read_only;
friend class Sql_cmd_resignal;
+ friend class Diagnostics_area;
};
extern char *err_conv(char *buff, uint to_length, const char *from,
@@ -498,6 +499,52 @@ public:
inline void set_warning_info(Warning_info *wi)
{ m_current_wi= wi; }
+public:
+ ulonglong warn_id() const
+ { return get_warning_info()->warn_id(); }
+
+ void set_warn_id(ulonglong warn_id)
+ { get_warning_info()->m_warn_id= warn_id; }
+
+ bool is_empty() const
+ { return get_warning_info()->is_empty(); }
+
+ void inc_current_row_for_warning()
+ { get_warning_info()->inc_current_row_for_warning(); }
+
+ void reset_current_row_for_warning()
+ { get_warning_info()->reset_current_row_for_warning(); }
+
+ ulong current_row_for_warning() const
+ { return get_warning_info()->current_row_for_warning(); }
+
+ void opt_clear_warning_info(ulonglong query_id)
+ { get_warning_info()->opt_clear_warning_info(query_id); }
+
+ void clear_warning_info(ulonglong warn_id)
+ { get_warning_info()->clear_warning_info(warn_id); }
+
+ List<MYSQL_ERROR> &warn_list()
+ { return get_warning_info()->warn_list(); }
+
+ ulong warn_count() const
+ { return get_warning_info()->warn_count(); }
+
+ ulong statement_warn_count() const
+ { return get_warning_info()->statement_warn_count(); }
+
+ ulong error_count() const
+ { return get_warning_info()->error_count(); }
+
+ bool is_read_only() const
+ { return get_warning_info()->is_read_only(); }
+
+ void set_read_only(bool read_only)
+ { get_warning_info()->set_read_only(read_only); }
+
+ void reset_for_next_command()
+ { get_warning_info()->reset_for_next_command(); }
+
private:
/** Message buffer. Can be used by OK or ERROR status. */
char m_message[MYSQL_ERRMSG_SIZE];
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2011-06-07 13:09:47 +0000
+++ b/sql/sql_insert.cc 2011-06-07 16:20:10 +0000
@@ -931,7 +931,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
error=write_record(thd, table ,&info);
if (error)
break;
- thd->get_warning_info()->inc_current_row_for_warning();
+ thd->get_stmt_da()->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->get_warning_info()->statement_warn_count());
+ (ulong) thd->get_stmt_da()->statement_warn_count());
else
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.deleted + updated),
- (ulong) thd->get_warning_info()->statement_warn_count());
+ (ulong) thd->get_stmt_da()->statement_warn_count());
::my_ok(thd, info.copied + info.deleted + updated, id, buff);
}
thd->abort_on_warning= 0;
@@ -3573,11 +3573,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->get_warning_info()->statement_warn_count());
+ (ulong) thd->get_stmt_da()->statement_warn_count());
else
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.deleted+info.updated),
- (ulong) thd->get_warning_info()->statement_warn_count());
+ (ulong) thd->get_stmt_da()->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-06-07 13:09:47 +0000
+++ b/sql/sql_load.cc 2011-06-07 16:20:10 +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->get_warning_info()->statement_warn_count());
+ (ulong) thd->get_stmt_da()->statement_warn_count());
#ifndef EMBEDDED_LIBRARY
if (mysql_bin_log.is_open())
@@ -833,7 +833,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->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
if (!field->maybe_null() && field->type() == FIELD_TYPE_TIMESTAMP)
((Field_timestamp*) field)->set_time();
}
@@ -857,7 +857,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->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
}
if (thd->killed ||
@@ -893,9 +893,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->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
}
- thd->get_warning_info()->inc_current_row_for_warning();
+ thd->get_stmt_da()->inc_current_row_for_warning();
continue_loop:;
}
DBUG_RETURN(test(read_info.error));
@@ -959,7 +959,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->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
DBUG_RETURN(1);
}
field->set_null();
@@ -1031,7 +1031,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->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
DBUG_RETURN(1);
}
if (!field->maybe_null() && field->type() == FIELD_TYPE_TIMESTAMP)
@@ -1046,7 +1046,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->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
}
else if (item->type() == Item::STRING_ITEM)
{
@@ -1092,11 +1092,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->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
if (thd->killed)
DBUG_RETURN(1);
}
- thd->get_warning_info()->inc_current_row_for_warning();
+ thd->get_stmt_da()->inc_current_row_for_warning();
continue_loop:;
}
DBUG_RETURN(test(read_info.error));
@@ -1230,7 +1230,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->get_warning_info()->current_row_for_warning());
+ thd->get_stmt_da()->current_row_for_warning());
}
else
((Item_user_var_as_out_param *)item)->set_null_value(cs);
@@ -1260,7 +1260,7 @@ read_xml_field(THD *thd, COPY_INFO &info
We don't need to reset auto-increment field since we are restoring
its default value at the beginning of each loop iteration.
*/
- thd->get_warning_info()->inc_current_row_for_warning();
+ thd->get_stmt_da()->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-06-07 13:09:47 +0000
+++ b/sql/sql_parse.cc 2011-06-07 16:20:10 +0000
@@ -2025,12 +2025,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->get_warning_info()->set_read_only(TRUE);
+ thd->get_stmt_da()->set_read_only(TRUE);
else
{
- thd->get_warning_info()->set_read_only(FALSE);
+ thd->get_stmt_da()->set_read_only(FALSE);
if (all_tables)
- thd->get_warning_info()->opt_clear_warning_info(thd->query_id);
+ thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
}
#ifdef HAVE_REPLICATION
@@ -5444,7 +5444,7 @@ void THD::reset_for_next_command()
}
thd->clear_error();
thd->get_stmt_da()->reset_diagnostics_area();
- thd->get_warning_info()->reset_for_next_command();
+ thd->get_stmt_da()->reset_for_next_command();
thd->rand_used= 0;
thd->m_sent_row_count= thd->m_examined_row_count= 0;
thd->thd_marker.emb_on_expr_nest= NULL;
=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc 2011-06-07 13:29:37 +0000
+++ b/sql/sql_prepare.cc 2011-06-07 16:20:10 +0000
@@ -340,7 +340,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->get_warning_info()->statement_warn_count(), 65535);
+ tmp= min(stmt->thd->get_stmt_da()->statement_warn_count(), 65535);
int2store(buff+10, tmp);
/*
@@ -1957,7 +1957,7 @@ static bool check_prepared_statement(Pre
/* Reset warning count for each query that uses tables */
if (tables)
- thd->get_warning_info()->opt_clear_warning_info(thd->query_id);
+ thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
if (sql_command_flags[sql_command] & CF_HA_CLOSE)
mysql_ha_rm_tables(thd, tables);
@@ -3553,7 +3553,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->get_warning_info()->clear_warning_info(thd->query_id);
+ thd->get_stmt_da()->clear_warning_info(thd->query_id);
}
return error;
}
@@ -3941,7 +3941,7 @@ Ed_connection::free_old_result()
}
m_current_rset= m_rsets;
m_diagnostics_area.reset_diagnostics_area();
- m_diagnostics_area.get_warning_info()->clear_warning_info(m_thd->query_id);
+ m_diagnostics_area.clear_warning_info(m_thd->query_id);
}
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2011-06-07 13:09:47 +0000
+++ b/sql/sql_select.cc 2011-06-07 16:20:10 +0000
@@ -17661,7 +17661,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->get_warning_info()->reset_current_row_for_warning();
+ join->thd->get_stmt_da()->reset_current_row_for_warning();
error= (*join_tab->read_first_record)(join_tab);
@@ -17988,7 +17988,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->get_warning_info()->inc_current_row_for_warning();
+ join->thd->get_stmt_da()->inc_current_row_for_warning();
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
DBUG_RETURN(rc);
@@ -18020,7 +18020,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
}
else
{
- join->thd->get_warning_info()->inc_current_row_for_warning();
+ join->thd->get_stmt_da()->inc_current_row_for_warning();
if (join_tab->not_null_compl)
{
/* a NULL-complemented row is not in a table so cannot be locked */
@@ -18035,7 +18035,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
with the beginning coinciding with the current partial join.
*/
join->examined_rows++;
- join->thd->get_warning_info()->inc_current_row_for_warning();
+ join->thd->get_stmt_da()->inc_current_row_for_warning();
if (join_tab->not_null_compl)
join_tab->read_record.unlock_row(join_tab);
}
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2011-06-07 13:29:37 +0000
+++ b/sql/sql_show.cc 2011-06-07 16:20:10 +0000
@@ -6805,7 +6805,7 @@ static bool do_fill_table(THD *thd,
// storing "unlimited" number of warnings.
Diagnostics_area *da= thd->get_stmt_da();
Warning_info wi(thd->query_id, true);
- Warning_info *wi_saved= thd->get_warning_info();
+ Warning_info *wi_saved= da->get_warning_info();
da->set_warning_info(&wi);
=== modified file 'sql/sql_signal.cc'
--- a/sql/sql_signal.cc 2011-06-07 13:09:47 +0000
+++ b/sql/sql_signal.cc 2011-06-07 16:20:10 +0000
@@ -469,7 +469,7 @@ bool Sql_cmd_signal::execute(THD *thd)
thd->get_stmt_da()->reset_diagnostics_area();
thd->set_row_count_func(0);
- thd->get_warning_info()->clear_warning_info(thd->query_id);
+ thd->get_stmt_da()->clear_warning_info(thd->query_id);
result= raise_condition(thd, &cond);
@@ -484,7 +484,7 @@ bool Sql_cmd_resignal::execute(THD *thd)
DBUG_ENTER("Sql_cmd_resignal::execute");
- thd->get_warning_info()->m_warn_id= thd->query_id;
+ thd->get_stmt_da()->set_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-06-07 13:09:47 +0000
+++ b/sql/sql_table.cc 2011-06-07 16:20:10 +0000
@@ -2942,7 +2942,7 @@ const CHARSET_INFO* get_sql_field_charse
bool check_duplicate_warning(THD *thd, char *msg, ulong length)
{
- List_iterator_fast<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
+ List_iterator_fast<MYSQL_ERROR> it(thd->get_stmt_da()->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
{
@@ -7053,7 +7053,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->get_warning_info()->statement_warn_count());
+ (ulong) thd->get_stmt_da()->statement_warn_count());
my_ok(thd, copied + deleted, 0L, tmp_name);
DBUG_RETURN(FALSE);
@@ -7080,7 +7080,7 @@ err:
Report error here.
*/
if (alter_info->error_if_not_empty &&
- thd->get_warning_info()->current_row_for_warning())
+ thd->get_stmt_da()->current_row_for_warning())
{
const char *f_val= 0;
enum enum_mysql_timestamp_type t_type= MYSQL_TIMESTAMP_DATE;
@@ -7285,7 +7285,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->get_warning_info()->reset_current_row_for_warning();
+ thd->get_stmt_da()->reset_current_row_for_warning();
restore_record(to, s->default_values); // Create empty record
while (!(error=info.read_record(&info)))
{
@@ -7344,7 +7344,7 @@ copy_data_between_tables(TABLE *from,TAB
}
else
found_count++;
- thd->get_warning_info()->inc_current_row_for_warning();
+ thd->get_stmt_da()->inc_current_row_for_warning();
}
end_read_record(&info);
free_io_cache(from);
=== modified file 'sql/sql_time.cc'
--- a/sql/sql_time.cc 2011-06-07 13:09:47 +0000
+++ b/sql/sql_time.cc 2011-06-07 16:20:10 +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->get_warning_info()->current_row_for_warning());
+ (ulong) thd->get_stmt_da()->current_row_for_warning());
else
{
if (time_type > MYSQL_TIMESTAMP_ERROR)
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2011-06-07 13:09:47 +0000
+++ b/sql/sql_update.cc 2011-06-07 16:20:10 +0000
@@ -791,7 +791,7 @@ int mysql_update(THD *thd,
}
else
table->file->unlock_row();
- thd->get_warning_info()->inc_current_row_for_warning();
+ thd->get_stmt_da()->inc_current_row_for_warning();
if (thd->is_error())
{
error= 1;
@@ -897,7 +897,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->get_warning_info()->statement_warn_count());
+ (ulong) thd->get_stmt_da()->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-06-07 13:09:47 +0000
+++ b/sql/sys_vars.cc 2011-06-07 16:20:10 +0000
@@ -2838,7 +2838,7 @@ static Sys_var_session_special Sys_rand_
static ulonglong read_error_count(THD *thd)
{
- return thd->get_warning_info()->error_count();
+ return thd->get_stmt_da()->error_count();
}
// this really belongs to the SHOW STATUS
static Sys_var_session_special Sys_error_count(
@@ -2850,7 +2850,7 @@ static Sys_var_session_special Sys_error
static ulonglong read_warning_count(THD *thd)
{
- return thd->get_warning_info()->warn_count();
+ return thd->get_stmt_da()->warn_count();
}
// this really belongs to the SHOW STATUS
static Sys_var_session_special Sys_warning_count(
Attachment: [text/bzr-bundle] bzr/alexander.nozdrin@oracle.com-20110607162010-4g19t4syr65bq3ku.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (alexander.nozdrin:3169) Bug#11763162 | Alexander Nozdrin | 7 Jun |