Commit e57c8007 authored by unknown's avatar unknown
Browse files

Manual merge from 5.0

parent 0fdd64ba
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,

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);
+1 −4
Original line number Diff line number Diff line
@@ -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;
    }
  }
+3 −2
Original line number Diff line number Diff line
@@ -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);
+6 −4
Original line number Diff line number Diff line
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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 |
Loading