upmerge to bug#14548159

This commit is contained in:
Rohit Kalhans 2012-09-22 18:07:04 +05:30
commit 1e5a759aff
24 changed files with 835 additions and 660 deletions

View file

@ -37,6 +37,7 @@
#include <my_dir.h>
#include <m_ctype.h>
#include "log.h"
#include "log_event.h"
#ifdef __WIN__
#include <direct.h>
#endif
@ -619,12 +620,17 @@ not_silent:
{
char *query;
uint query_length;
char db_name_quoted[2 * FN_REFLEN + sizeof("create database ") + 2];
int id_len= 0;
if (!thd->query()) // Only in replication
{
query= tmp_query;
query_length= (uint) (strxmov(tmp_query,"create database `",
db, "`", NullS) - tmp_query);
id_len= my_strmov_quoted_identifier(thd, (char *) db_name_quoted, db,
0);
db_name_quoted[id_len]= '\0';
query= tmp_query;
query_length= (uint) (strxmov(tmp_query,"create database ",
db_name_quoted, NullS) - tmp_query);
}
else
{
@ -761,7 +767,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
{
ulong deleted_tables= 0;
bool error= true;
char path[FN_REFLEN+16];
char path[2 * FN_REFLEN + 16];
MY_DIR *dirp;
uint length;
bool found_other_files= false;
@ -883,11 +889,16 @@ update_binlog:
{
const char *query;
ulong query_length;
// quoted db name + wraping quote
char buffer_temp [2 * FN_REFLEN + 2];
int id_len= 0;
if (!thd->query())
{
/* The client used the old obsolete mysql_drop_db() call */
query= path;
query_length= (uint) (strxmov(path, "drop database `", db, "`",
id_len= my_strmov_quoted_identifier(thd, buffer_temp, db, strlen(db));
buffer_temp[id_len] ='\0';
query_length= (uint) (strxmov(path, "DROP DATABASE ", buffer_temp, "",
NullS) - path);
}
else
@ -925,12 +936,13 @@ update_binlog:
else if (mysql_bin_log.is_open() && !silent)
{
char *query, *query_pos, *query_end, *query_data_start;
char temp_identifier[ 2 * FN_REFLEN + 2];
TABLE_LIST *tbl;
uint db_len;
uint db_len, id_length=0;
if (!(query= (char*) thd->alloc(MAX_DROP_TABLE_Q_LEN)))
goto exit; /* not much else we can do */
query_pos= query_data_start= strmov(query,"drop table ");
query_pos= query_data_start= strmov(query,"DROP TABLE ");
query_end= query + MAX_DROP_TABLE_Q_LEN;
db_len= strlen(db);
@ -963,10 +975,10 @@ update_binlog:
}
query_pos= query_data_start;
}
*query_pos++ = '`';
query_pos= strmov(query_pos,tbl->table_name);
*query_pos++ = '`';
id_length= my_strmov_quoted_identifier(thd, (char *)temp_identifier,
tbl->table_name, 0);
temp_identifier[id_length]= '\0';
query_pos= strmov(query_pos,(char *)&temp_identifier);
*query_pos++ = ',';
}