1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug #40877: multi statement execution fails in 5.1.30

Implemented the server infrastructure for the fix:

1. Added a function LEX_STRING *thd_query_string(THD) to return
a LEX_STRING structure instead of char *.
This is the function that must be called in innodb instead of 
thd_query()

2. Did some encapsulation in THD : aggregated thd_query and 
thd_query_length into a LEX_STRING and made accessor and mutator 
methods for easy code updating. 

3. Updated the server code to use the new methods where applicable.
This commit is contained in:
Georgi Kodinov
2009-10-16 13:29:42 +03:00
parent 9c76415a03
commit 8f6f3dba21
32 changed files with 185 additions and 155 deletions

View File

@ -2089,7 +2089,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
tables). In this case, we can write the original query into
the binary log.
*/
write_bin_log(thd, !error, thd->query, thd->query_length);
write_bin_log(thd, !error, thd->query(), thd->query_length());
}
else if (thd->current_stmt_binlog_row_based &&
tmp_table_deleted)
@ -3554,7 +3554,7 @@ static inline void write_create_table_bin_log(THD *thd,
(!thd->current_stmt_binlog_row_based ||
(thd->current_stmt_binlog_row_based &&
!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
write_bin_log(thd, TRUE, thd->query, thd->query_length);
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
@ -5427,14 +5427,14 @@ binlog:
write_bin_log(thd, TRUE, query.ptr(), query.length());
}
else // Case 1
write_bin_log(thd, TRUE, thd->query, thd->query_length);
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
/*
Case 3 and 4 does nothing under RBR
*/
}
else
write_bin_log(thd, TRUE, thd->query, thd->query_length);
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
res= FALSE;
@ -5522,7 +5522,7 @@ mysql_discard_or_import_tablespace(THD *thd,
error=1;
if (error)
goto err;
write_bin_log(thd, FALSE, thd->query, thd->query_length);
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
err:
ha_autocommit_or_rollback(thd, error);
@ -6531,7 +6531,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (mysql_bin_log.is_open())
{
thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length,
Query_log_event qinfo(thd, thd->query(), thd->query_length(),
0, FALSE, 0);
mysql_bin_log.write(&qinfo);
}
@ -6785,7 +6785,7 @@ view_err:
if (!error)
{
write_bin_log(thd, TRUE, thd->query, thd->query_length);
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
my_ok(thd);
}
else if (error > 0)
@ -7275,7 +7275,7 @@ view_err:
goto err1;
/* We don't replicate alter table statement on temporary tables */
if (!thd->current_stmt_binlog_row_based)
write_bin_log(thd, TRUE, thd->query, thd->query_length);
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
goto end_temporary;
}
@ -7432,13 +7432,13 @@ view_err:
DBUG_EXECUTE_IF("sleep_alter_before_main_binlog", my_sleep(6000000););
ha_binlog_log_query(thd, create_info->db_type, LOGCOM_ALTER_TABLE,
thd->query, thd->query_length,
thd->query(), thd->query_length(),
db, table_name);
DBUG_ASSERT(!(mysql_bin_log.is_open() &&
thd->current_stmt_binlog_row_based &&
(create_info->options & HA_LEX_CREATE_TMP_TABLE)));
write_bin_log(thd, TRUE, thd->query, thd->query_length);
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
if (ha_check_storage_engine_flag(old_db_type, HTON_FLUSH_AFTER_RENAME))
{