diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/event_db_repository.cc | 4 | ||||
-rw-r--r-- | sql/set_var.cc | 5 | ||||
-rw-r--r-- | sql/sql_connect.cc | 5 | ||||
-rw-r--r-- | sql/sql_db.cc | 10 | ||||
-rw-r--r-- | sql/sql_insert.cc | 6 | ||||
-rw-r--r-- | sql/sql_parse.cc | 12 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 |
7 files changed, 23 insertions, 21 deletions
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 7232390ef69..7328e2184e4 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -644,7 +644,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data, ok: 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 inside init_key_cache on my system (ahristov, 2006/08/10) @@ -654,7 +654,7 @@ ok: err: if (dbchanged) - (void) mysql_change_db(thd, old_db.str, 1); + (void) mysql_change_db(thd, &old_db, 1); if (table) close_thread_tables(thd); DBUG_RETURN(TRUE); diff --git a/sql/set_var.cc b/sql/set_var.cc index b8459c33bc2..de214164c0a 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -3083,9 +3083,7 @@ static bool set_option_autocommit(THD *thd, set_var *var) if ((org_options & OPTION_NOT_AUTOCOMMIT)) { /* We changed to auto_commit mode */ - thd->options&= ~(ulonglong) (OPTION_BEGIN | - OPTION_STATUS_NO_TRANS_UPDATE | - OPTION_KEEP_LOG); + thd->options&= ~(ulonglong) (OPTION_BEGIN | OPTION_KEEP_LOG); thd->no_trans_update.all= FALSE; thd->server_status|= SERVER_STATUS_AUTOCOMMIT; if (ha_commit(thd)) @@ -3094,7 +3092,6 @@ static bool set_option_autocommit(THD *thd, set_var *var) else { thd->no_trans_update.all= FALSE; - thd->options&= ~(ulonglong) (OPTION_STATUS_NO_TRANS_UPDATE); thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT; } } diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 09ee4962235..d03a17079d8 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -315,6 +315,7 @@ int check_user(THD *thd, enum enum_server_command command, bool check_count) { DBUG_ENTER("check_user"); + LEX_STRING db_str= { (char *) db, db ? strlen(db) : 0 }; #ifdef NO_EMBEDDED_ACCESS_CHECKS 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 */ 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 */ net_send_error(thd); @@ -472,7 +473,7 @@ int check_user(THD *thd, enum enum_server_command command, /* Change database if necessary */ if (db && db[0]) { - if (mysql_change_db(thd, db, FALSE)) + if (mysql_change_db(thd, &db_str, FALSE)) { /* Send error to the client */ net_send_error(thd); diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 4e96a987d99..f529a21b109 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -22,6 +22,7 @@ #include "events.h" #include <my_dir.h> #include <m_ctype.h> +#include "log.h" #ifdef __WIN__ #include <direct.h> #endif @@ -1420,7 +1421,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) 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_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_host, new_db_file_name.str); - mysql_log.write(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR), - sctx->priv_user, sctx->priv_host, new_db_file_name.str); + general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR), + sctx->priv_user, sctx->priv_host, + new_db_file_name.str); my_free(new_db_file_name.str, MYF(0)); 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 */ if (change_to_newdb) - error|= mysql_change_db(thd, new_db->str, 0); + error|= mysql_change_db(thd, new_db, 0); exit: pthread_mutex_lock(&LOCK_lock_db); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 4eff7e4edeb..9c20ad6922b 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -712,7 +712,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, } } if (!transactional_table) - thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; + thd->no_trans_update.all= TRUE; } } if (transactional_table) @@ -1322,7 +1322,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) goto err; info->deleted++; if (!table->file->has_transactions()) - thd->no_trans_update= 1; + thd->no_trans_update.stmt= TRUE; if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_DELETE, TRG_ACTION_AFTER, TRUE)) @@ -2638,7 +2638,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u) if (info.handle_duplicates == DUP_REPLACE && (!table->triggers || !table->triggers->has_delete_triggers())) 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->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ff7e06e1875..3665d7f0b03 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -720,7 +720,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, &LOCK_status); thd->convert_string(&tmp, system_charset_info, 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); send_ok(thd); @@ -4208,8 +4208,8 @@ create_sp_error: xa_state_names[thd->transaction.xid_state.xa_state]); break; } - thd->options&= ~(OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE | - OPTION_KEEP_LOG); + thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG); + thd->no_trans_update.all= FALSE; thd->server_status&= ~SERVER_STATUS_IN_TRANS; xid_cache_delete(&thd->transaction.xid_state); 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. */ 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); thd->tmp_table_used= 0; if (!thd->in_sub_stmt) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index f438e04e6c9..988e81033c7 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -535,7 +535,7 @@ int mysql_update(THD *thd, if (!error) { updated++; - thd->no_trans_update= !transactional_table; + thd->no_trans_update.stmt= !transactional_table; if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, |