Skip to content

Commit f620cae

Browse files
author
Alexander Nozdrin
committed
Manual merge from mysql-trunk-merge.
2 parents 06bfaf2 + 85f3e8c commit f620cae

32 files changed

Lines changed: 187 additions & 157 deletions

sql/event_data_objects.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ Event_job_data::execute(THD *thd, bool drop)
14351435
thd->set_query(sp_sql.c_ptr_safe(), sp_sql.length());
14361436

14371437
{
1438-
Parser_state parser_state(thd, thd->query, thd->query_length);
1438+
Parser_state parser_state(thd, thd->query(), thd->query_length());
14391439
lex_start(thd);
14401440

14411441
if (parse_sql(thd, & parser_state, creation_ctx))

sql/events.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
465465
if (!dropped)
466466
{
467467
/* Binlog the create event. */
468-
DBUG_ASSERT(thd->query && thd->query_length);
468+
DBUG_ASSERT(thd->query() && thd->query_length());
469469
String log_query;
470470
if (create_query_string(thd, &log_query))
471471
{
@@ -595,8 +595,8 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
595595
event_queue->update_event(thd, parse_data->dbname, parse_data->name,
596596
new_element);
597597
/* Binlog the alter event. */
598-
DBUG_ASSERT(thd->query && thd->query_length);
599-
write_bin_log(thd, TRUE, thd->query, thd->query_length);
598+
DBUG_ASSERT(thd->query() && thd->query_length());
599+
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
600600
}
601601
}
602602
pthread_mutex_unlock(&LOCK_event_metadata);
@@ -670,8 +670,8 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
670670
if (event_queue)
671671
event_queue->drop_event(thd, dbname, name);
672672
/* Binlog the drop event. */
673-
DBUG_ASSERT(thd->query && thd->query_length);
674-
write_bin_log(thd, TRUE, thd->query, thd->query_length);
673+
DBUG_ASSERT(thd->query() && thd->query_length());
674+
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
675675
}
676676
pthread_mutex_unlock(&LOCK_event_metadata);
677677
DBUG_RETURN(ret);

sql/ha_ndbcluster.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5580,7 +5580,7 @@ int ha_ndbcluster::create(const char *name,
55805580
if (share && !do_event_op)
55815581
share->flags|= NSF_NO_BINLOG;
55825582
ndbcluster_log_schema_op(thd, share,
5583-
thd->query, thd->query_length,
5583+
thd->query(), thd->query_length(),
55845584
share->db, share->table_name,
55855585
m_table->getObjectId(),
55865586
m_table->getObjectVersion(),
@@ -6022,7 +6022,8 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
60226022
*/
60236023
if (!is_old_table_tmpfile)
60246024
ndbcluster_log_schema_op(current_thd, share,
6025-
current_thd->query, current_thd->query_length,
6025+
current_thd->query(),
6026+
current_thd->query_length(),
60266027
old_dbname, m_tabname,
60276028
ndb_table_id, ndb_table_version,
60286029
SOT_RENAME_TABLE,
@@ -6217,7 +6218,7 @@ ha_ndbcluster::delete_table(ha_ndbcluster *h, Ndb *ndb,
62176218
current_thd->lex->sql_command != SQLCOM_TRUNCATE)
62186219
{
62196220
ndbcluster_log_schema_op(thd, share,
6220-
thd->query, thd->query_length,
6221+
thd->query(), thd->query_length(),
62216222
share->db, share->table_name,
62226223
ndb_table_id, ndb_table_version,
62236224
SOT_DROP_TABLE, 0, 0, 1);
@@ -6939,7 +6940,7 @@ static void ndbcluster_drop_database(handlerton *hton, char *path)
69396940
THD *thd= current_thd;
69406941
ha_ndbcluster::set_dbname(path, db);
69416942
ndbcluster_log_schema_op(thd, 0,
6942-
thd->query, thd->query_length,
6943+
thd->query(), thd->query_length(),
69436944
db, "", 0, 0, SOT_DROP_DB, 0, 0, 0);
69446945
#endif
69456946
DBUG_VOID_RETURN;
@@ -10348,13 +10349,13 @@ int ndbcluster_alter_tablespace(handlerton *hton,
1034810349
#ifdef HAVE_NDB_BINLOG
1034910350
if (is_tablespace)
1035010351
ndbcluster_log_schema_op(thd, 0,
10351-
thd->query, thd->query_length,
10352+
thd->query(), thd->query_length(),
1035210353
"", alter_info->tablespace_name,
1035310354
0, 0,
1035410355
SOT_TABLESPACE, 0, 0, 0);
1035510356
else
1035610357
ndbcluster_log_schema_op(thd, 0,
10357-
thd->query, thd->query_length,
10358+
thd->query(), thd->query_length(),
1035810359
"", alter_info->logfile_group_name,
1035910360
0, 0,
1036010361
SOT_LOGFILE_GROUP, 0, 0, 0);

sql/ha_ndbcluster_binlog.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ static void dbug_print_table(const char *info, TABLE *table)
241241
static void run_query(THD *thd, char *buf, char *end,
242242
const int *no_print_error, my_bool disable_binlog)
243243
{
244-
ulong save_thd_query_length= thd->query_length;
245-
char *save_thd_query= thd->query;
244+
ulong save_thd_query_length= thd->query_length();
245+
char *save_thd_query= thd->query();
246246
ulong save_thread_id= thd->variables.pseudo_thread_id;
247247
struct system_status_var save_thd_status_var= thd->status_var;
248248
THD_TRANS save_thd_transaction_all= thd->transaction.all;
@@ -259,12 +259,12 @@ static void run_query(THD *thd, char *buf, char *end,
259259
if (disable_binlog)
260260
thd->options&= ~OPTION_BIN_LOG;
261261

262-
DBUG_PRINT("query", ("%s", thd->query));
262+
DBUG_PRINT("query", ("%s", thd->query()));
263263

264264
DBUG_ASSERT(!thd->in_sub_stmt);
265265
DBUG_ASSERT(!thd->prelocked_mode);
266266

267-
mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);
267+
mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon);
268268

269269
if (no_print_error && thd->is_slave_error)
270270
{

sql/log.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv)
17301730
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
17311731
int const error=
17321732
thd->binlog_query(THD::STMT_QUERY_TYPE,
1733-
thd->query, thd->query_length, TRUE, FALSE, errcode);
1733+
thd->query(), thd->query_length(), TRUE, FALSE, errcode);
17341734
DBUG_RETURN(error);
17351735
}
17361736

@@ -1749,7 +1749,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
17491749
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
17501750
int error=
17511751
thd->binlog_query(THD::STMT_QUERY_TYPE,
1752-
thd->query, thd->query_length, TRUE, FALSE, errcode);
1752+
thd->query(), thd->query_length(), TRUE, FALSE, errcode);
17531753
DBUG_RETURN(error);
17541754
}
17551755
binlog_trans_log_truncate(thd, *(my_off_t*)sv);

sql/log_event.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3060,7 +3060,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
30603060
thd->query_id = next_query_id();
30613061
VOID(pthread_mutex_unlock(&LOCK_thread_count));
30623062
thd->variables.pseudo_thread_id= thread_id; // for temp tables
3063-
DBUG_PRINT("query",("%s",thd->query));
3063+
DBUG_PRINT("query",("%s", thd->query()));
30643064

30653065
if (ignored_error_code((expected_error= error_code)) ||
30663066
!unexpected_error_code(expected_error))
@@ -3154,7 +3154,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
31543154

31553155
/* Execute the query (note that we bypass dispatch_command()) */
31563156
const char* found_semicolon= NULL;
3157-
mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);
3157+
mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon);
31583158
log_slow_statement(thd);
31593159
}
31603160
else
@@ -3166,7 +3166,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
31663166
we exit gracefully; otherwise we warn about the bad error and tell DBA
31673167
to check/fix it.
31683168
*/
3169-
if (mysql_test_parse_for_slave(thd, thd->query, thd->query_length))
3169+
if (mysql_test_parse_for_slave(thd, thd->query(), thd->query_length()))
31703170
clear_all_errors(thd, const_cast<Relay_log_info*>(rli)); /* Can ignore query */
31713171
else
31723172
{
@@ -3176,15 +3176,15 @@ Query partially completed on the master (error on master: %d) \
31763176
and was aborted. There is a chance that your master is inconsistent at this \
31773177
point. If you are sure that your master is ok, run this query manually on the \
31783178
slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; \
3179-
START SLAVE; . Query: '%s'", expected_error, thd->query);
3179+
START SLAVE; . Query: '%s'", expected_error, thd->query());
31803180
thd->is_slave_error= 1;
31813181
}
31823182
goto end;
31833183
}
31843184

31853185
/* If the query was not ignored, it is printed to the general log */
31863186
if (!thd->is_error() || thd->stmt_da->sql_errno() != ER_SLAVE_IGNORED_TABLE)
3187-
general_log_write(thd, COM_QUERY, thd->query, thd->query_length);
3187+
general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
31883188

31893189
compare_errors:
31903190

@@ -4531,8 +4531,8 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
45314531
new_db.length= db_len;
45324532
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
45334533
thd->set_db(new_db.str, new_db.length);
4534-
DBUG_ASSERT(thd->query == 0);
4535-
thd->query_length= 0; // Should not be needed
4534+
DBUG_ASSERT(thd->query() == 0);
4535+
thd->set_query_inner(NULL, 0); // Should not be needed
45364536
thd->is_slave_error= 0;
45374537
clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
45384538

sql/mysqld.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2526,7 +2526,7 @@ terribly wrong...\n");
25262526
}
25272527
fprintf(stderr, "Trying to get some variables.\n\
25282528
Some pointers may be invalid and cause the dump to abort...\n");
2529-
my_safe_print_str("thd->query", thd->query, 1024);
2529+
my_safe_print_str("thd->query", thd->query(), 1024);
25302530
fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id);
25312531
fprintf(stderr, "thd->killed=%s\n", kreason);
25322532
}

sql/slave.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,8 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
15521552
thd->db = (char*)db;
15531553
DBUG_ASSERT(thd->db != 0);
15541554
thd->db_length= strlen(thd->db);
1555-
mysql_parse(thd, thd->query, packet_len, &found_semicolon); // run create table
1555+
/* run create table */
1556+
mysql_parse(thd, thd->query(), packet_len, &found_semicolon);
15561557
thd->db = save_db; // leave things the way the were before
15571558
thd->db_length= save_db_length;
15581559
thd->options = save_options;

sql/sp.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
10051005

10061006
if (ret == SP_OK)
10071007
{
1008-
write_bin_log(thd, TRUE, thd->query, thd->query_length);
1008+
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
10091009
sp_cache_invalidate();
10101010
}
10111011

@@ -1075,7 +1075,7 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
10751075

10761076
if (ret == SP_OK)
10771077
{
1078-
write_bin_log(thd, TRUE, thd->query, thd->query_length);
1078+
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
10791079
sp_cache_invalidate();
10801080
}
10811081

sql/sp_head.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,8 +2859,8 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
28592859
DBUG_ENTER("sp_instr_stmt::execute");
28602860
DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
28612861

2862-
query= thd->query;
2863-
query_length= thd->query_length;
2862+
query= thd->query();
2863+
query_length= thd->query_length();
28642864
#if defined(ENABLED_PROFILING)
28652865
/* This s-p instr is profilable and will be captured. */
28662866
thd->profiling.set_query_source(m_query.str, m_query.length);
@@ -2873,10 +2873,11 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
28732873
queries with SP vars can't be cached)
28742874
*/
28752875
if (unlikely((thd->options & OPTION_LOG_OFF)==0))
2876-
general_log_write(thd, COM_QUERY, thd->query, thd->query_length);
2876+
general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
28772877

28782878
if (query_cache_send_result_to_client(thd,
2879-
thd->query, thd->query_length) <= 0)
2879+
thd->query(),
2880+
thd->query_length()) <= 0)
28802881
{
28812882
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
28822883

0 commit comments

Comments
 (0)