mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Manual merge from 5.0
This commit is contained in:
@ -644,7 +644,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
|||||||
|
|
||||||
ok:
|
ok:
|
||||||
if (dbchanged)
|
if (dbchanged)
|
||||||
(void) mysql_change_db(thd, old_db.str, 1);
|
(void) mysql_change_db(thd, &old_db, 1);
|
||||||
/*
|
/*
|
||||||
This statement may cause a spooky valgrind warning at startup
|
This statement may cause a spooky valgrind warning at startup
|
||||||
inside init_key_cache on my system (ahristov, 2006/08/10)
|
inside init_key_cache on my system (ahristov, 2006/08/10)
|
||||||
@ -654,7 +654,7 @@ ok:
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
if (dbchanged)
|
if (dbchanged)
|
||||||
(void) mysql_change_db(thd, old_db.str, 1);
|
(void) mysql_change_db(thd, &old_db, 1);
|
||||||
if (table)
|
if (table)
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
@ -3083,9 +3083,7 @@ static bool set_option_autocommit(THD *thd, set_var *var)
|
|||||||
if ((org_options & OPTION_NOT_AUTOCOMMIT))
|
if ((org_options & OPTION_NOT_AUTOCOMMIT))
|
||||||
{
|
{
|
||||||
/* We changed to auto_commit mode */
|
/* We changed to auto_commit mode */
|
||||||
thd->options&= ~(ulonglong) (OPTION_BEGIN |
|
thd->options&= ~(ulonglong) (OPTION_BEGIN | OPTION_KEEP_LOG);
|
||||||
OPTION_STATUS_NO_TRANS_UPDATE |
|
|
||||||
OPTION_KEEP_LOG);
|
|
||||||
thd->no_trans_update.all= FALSE;
|
thd->no_trans_update.all= FALSE;
|
||||||
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
|
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
|
||||||
if (ha_commit(thd))
|
if (ha_commit(thd))
|
||||||
@ -3094,7 +3092,6 @@ static bool set_option_autocommit(THD *thd, set_var *var)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
thd->no_trans_update.all= FALSE;
|
thd->no_trans_update.all= FALSE;
|
||||||
thd->options&= ~(ulonglong) (OPTION_STATUS_NO_TRANS_UPDATE);
|
|
||||||
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
|
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,6 +315,7 @@ int check_user(THD *thd, enum enum_server_command command,
|
|||||||
bool check_count)
|
bool check_count)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("check_user");
|
DBUG_ENTER("check_user");
|
||||||
|
LEX_STRING db_str= { (char *) db, db ? strlen(db) : 0 };
|
||||||
|
|
||||||
#ifdef NO_EMBEDDED_ACCESS_CHECKS
|
#ifdef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
thd->main_security_ctx.master_access= GLOBAL_ACLS; // Full rights
|
thd->main_security_ctx.master_access= GLOBAL_ACLS; // Full rights
|
||||||
@ -326,7 +327,7 @@ int check_user(THD *thd, enum enum_server_command command,
|
|||||||
function returns 0
|
function returns 0
|
||||||
*/
|
*/
|
||||||
thd->reset_db(NULL, 0);
|
thd->reset_db(NULL, 0);
|
||||||
if (mysql_change_db(thd, db, FALSE))
|
if (mysql_change_db(thd, &db_str, FALSE))
|
||||||
{
|
{
|
||||||
/* Send the error to the client */
|
/* Send the error to the client */
|
||||||
net_send_error(thd);
|
net_send_error(thd);
|
||||||
@ -472,7 +473,7 @@ int check_user(THD *thd, enum enum_server_command command,
|
|||||||
/* Change database if necessary */
|
/* Change database if necessary */
|
||||||
if (db && db[0])
|
if (db && db[0])
|
||||||
{
|
{
|
||||||
if (mysql_change_db(thd, db, FALSE))
|
if (mysql_change_db(thd, &db_str, FALSE))
|
||||||
{
|
{
|
||||||
/* Send error to the client */
|
/* Send error to the client */
|
||||||
net_send_error(thd);
|
net_send_error(thd);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include <my_dir.h>
|
#include <my_dir.h>
|
||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
|
#include "log.h"
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#endif
|
#endif
|
||||||
@ -1420,7 +1421,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
|
|||||||
to be sure.
|
to be sure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (check_db_name(new_db_file_name.str))
|
if (check_db_name(&new_db_file_name))
|
||||||
{
|
{
|
||||||
my_error(ER_WRONG_DB_NAME, MYF(0), new_db_file_name.str);
|
my_error(ER_WRONG_DB_NAME, MYF(0), new_db_file_name.str);
|
||||||
my_free(new_db_file_name.str, MYF(0));
|
my_free(new_db_file_name.str, MYF(0));
|
||||||
@ -1454,8 +1455,9 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
|
|||||||
sctx->priv_user,
|
sctx->priv_user,
|
||||||
sctx->priv_host,
|
sctx->priv_host,
|
||||||
new_db_file_name.str);
|
new_db_file_name.str);
|
||||||
mysql_log.write(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR),
|
general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR),
|
||||||
sctx->priv_user, sctx->priv_host, new_db_file_name.str);
|
sctx->priv_user, sctx->priv_host,
|
||||||
|
new_db_file_name.str);
|
||||||
my_free(new_db_file_name.str, MYF(0));
|
my_free(new_db_file_name.str, MYF(0));
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
@ -1801,7 +1803,7 @@ bool mysql_rename_db(THD *thd, LEX_STRING *old_db, LEX_STRING *new_db)
|
|||||||
|
|
||||||
/* Step9: Let's do "use newdb" if we renamed the current database */
|
/* Step9: Let's do "use newdb" if we renamed the current database */
|
||||||
if (change_to_newdb)
|
if (change_to_newdb)
|
||||||
error|= mysql_change_db(thd, new_db->str, 0);
|
error|= mysql_change_db(thd, new_db, 0);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
pthread_mutex_lock(&LOCK_lock_db);
|
pthread_mutex_lock(&LOCK_lock_db);
|
||||||
|
@ -712,7 +712,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!transactional_table)
|
if (!transactional_table)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transactional_table)
|
if (transactional_table)
|
||||||
@ -1322,7 +1322,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
|||||||
goto err;
|
goto err;
|
||||||
info->deleted++;
|
info->deleted++;
|
||||||
if (!table->file->has_transactions())
|
if (!table->file->has_transactions())
|
||||||
thd->no_trans_update= 1;
|
thd->no_trans_update.stmt= TRUE;
|
||||||
if (table->triggers &&
|
if (table->triggers &&
|
||||||
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
|
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
|
||||||
TRG_ACTION_AFTER, TRUE))
|
TRG_ACTION_AFTER, TRUE))
|
||||||
@ -2638,7 +2638,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
if (info.handle_duplicates == DUP_REPLACE &&
|
if (info.handle_duplicates == DUP_REPLACE &&
|
||||||
(!table->triggers || !table->triggers->has_delete_triggers()))
|
(!table->triggers || !table->triggers->has_delete_triggers()))
|
||||||
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
|
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= (!info.ignore &&
|
thd->abort_on_warning= (!info.ignore &&
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
|
@ -720,7 +720,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
&LOCK_status);
|
&LOCK_status);
|
||||||
thd->convert_string(&tmp, system_charset_info,
|
thd->convert_string(&tmp, system_charset_info,
|
||||||
packet, packet_length-1, thd->charset());
|
packet, packet_length-1, thd->charset());
|
||||||
if (!mysql_change_db(thd, tmp.str, FALSE))
|
if (!mysql_change_db(thd, &tmp, FALSE))
|
||||||
{
|
{
|
||||||
general_log_print(thd, command, "%s",thd->db);
|
general_log_print(thd, command, "%s",thd->db);
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
@ -4208,8 +4208,8 @@ create_sp_error:
|
|||||||
xa_state_names[thd->transaction.xid_state.xa_state]);
|
xa_state_names[thd->transaction.xid_state.xa_state]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
thd->options&= ~(OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE |
|
thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
|
||||||
OPTION_KEEP_LOG);
|
thd->no_trans_update.all= FALSE;
|
||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
xid_cache_delete(&thd->transaction.xid_state);
|
xid_cache_delete(&thd->transaction.xid_state);
|
||||||
thd->transaction.xid_state.xa_state=XA_NOTR;
|
thd->transaction.xid_state.xa_state=XA_NOTR;
|
||||||
@ -5023,8 +5023,10 @@ void mysql_reset_thd_for_next_command(THD *thd)
|
|||||||
in ha_rollback_trans() about some tables couldn't be rolled back.
|
in ha_rollback_trans() about some tables couldn't be rolled back.
|
||||||
*/
|
*/
|
||||||
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
|
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
|
||||||
thd->options&= ~(OPTION_STATUS_NO_TRANS_UPDATE | OPTION_KEEP_LOG);
|
{
|
||||||
|
thd->options&= ~OPTION_KEEP_LOG;
|
||||||
|
thd->no_trans_update.all= FALSE;
|
||||||
|
}
|
||||||
DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx);
|
DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx);
|
||||||
thd->tmp_table_used= 0;
|
thd->tmp_table_used= 0;
|
||||||
if (!thd->in_sub_stmt)
|
if (!thd->in_sub_stmt)
|
||||||
|
@ -535,7 +535,7 @@ int mysql_update(THD *thd,
|
|||||||
if (!error)
|
if (!error)
|
||||||
{
|
{
|
||||||
updated++;
|
updated++;
|
||||||
thd->no_trans_update= !transactional_table;
|
thd->no_trans_update.stmt= !transactional_table;
|
||||||
|
|
||||||
if (table->triggers &&
|
if (table->triggers &&
|
||||||
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
||||||
|
Reference in New Issue
Block a user