MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:August 19 2010 5:38pm
Subject:bzr commit into mysql-5.5-bugfixing branch (alik:3114) Bug#27480
View as plain text  
#At file:///mnt/raid/alik/MySQL/bzr/00/bug27480/mysql-5.5-runtime-bug27480.2/ based on revid:jon.hauglid@stripped

 3114 Alexander Nozdrin	2010-08-19
      Bug#27480 (Extend CREATE TEMPORARY TABLES privilege
      to allow temp table operations) -- prerequisite patch #1:
      
      move a piece of code that sets TABLE instance attributes
      after it was successfully opened into a separate function.
      This function will be reused in the following patches.

    modified:
      sql/sql_base.cc
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2010-08-19 09:33:37 +0000
+++ b/sql/sql_base.cc	2010-08-19 17:38:24 +0000
@@ -2173,6 +2173,56 @@ bool rename_temporary_table(THD* thd, TA
   DBUG_RETURN(0);
 }
 
+static void set_table_attributes_after_opening(THD *thd,
+                                               TABLE_LIST *table_list,
+                                               TABLE *table)
+{
+  DBUG_ASSERT(table->s->ref_count > 0 || table->s->tmp_table != NO_TMP_TABLE);
+
+  if (thd->lex->need_correct_ident())
+    table->alias_name_used= my_strcasecmp(table_alias_charset,
+                                          table->s->table_name.str,
+                                          table_list->alias);
+  /* Fix alias if table name changes. */
+  if (strcmp(table->alias, table_list->alias))
+  {
+    uint length= (uint) strlen(table_list->alias)+1;
+    table->alias= (char*) my_realloc((char*) table->alias, length,
+                                     MYF(MY_WME));
+    memcpy((char*) table->alias, table_list->alias, length);
+  }
+
+  table->tablenr= thd->current_tablenr++;
+  table->used_fields= 0;
+  table->const_table= 0;
+  table->null_row= 0;
+  table->maybe_null= 0;
+  table->force_index= 0;
+  table->force_index_order= 0;
+  table->force_index_group= 0;
+  table->status= STATUS_NO_RECORD;
+  table->insert_values= 0;
+  table->fulltext_searched= 0;
+  table->file->ft_handler= 0;
+  table->reginfo.impossible_range= 0;
+
+  /* Catch wrong handling of the auto_increment_field_not_null. */
+  DBUG_ASSERT(!table->auto_increment_field_not_null);
+  table->auto_increment_field_not_null= FALSE;
+
+  if (table->timestamp_field)
+    table->timestamp_field_type= table->timestamp_field->get_auto_set_type();
+
+  table->pos_in_table_list= table_list;
+
+  table->clear_column_bitmaps();
+
+  DBUG_ASSERT(table->key_read == 0);
+
+  /* Tables may be reused in a sub statement. */
+  DBUG_ASSERT(! table->file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN));
+}
+
 
 /**
    Force all other threads to stop using the table by upgrading
@@ -3016,41 +3066,11 @@ retry_share:
   table->reginfo.lock_type=TL_READ;		/* Assume read */
 
  reset:
-  DBUG_ASSERT(table->s->ref_count > 0 || table->s->tmp_table != NO_TMP_TABLE);
-
-  if (thd->lex->need_correct_ident())
-    table->alias_name_used= my_strcasecmp(table_alias_charset,
-                                          table->s->table_name.str, alias);
-  /* Fix alias if table name changes */
-  if (strcmp(table->alias, alias))
-  {
-    uint length=(uint) strlen(alias)+1;
-    table->alias= (char*) my_realloc((char*) table->alias, length,
-                                     MYF(MY_WME));
-    memcpy((char*) table->alias, alias, length);
-  }
-  table->tablenr=thd->current_tablenr++;
-  table->used_fields=0;
-  table->const_table=0;
-  table->null_row= table->maybe_null= 0;
-  table->force_index= table->force_index_order= table->force_index_group= 0;
-  table->status=STATUS_NO_RECORD;
-  table->insert_values= 0;
-  table->fulltext_searched= 0;
-  table->file->ft_handler= 0;
-  table->reginfo.impossible_range= 0;
-  /* Catch wrong handling of the auto_increment_field_not_null. */
-  DBUG_ASSERT(!table->auto_increment_field_not_null);
-  table->auto_increment_field_not_null= FALSE;
-  if (table->timestamp_field)
-    table->timestamp_field_type= table->timestamp_field->get_auto_set_type();
-  table->pos_in_table_list= table_list;
   table_list->updatable= 1; // It is not derived table nor non-updatable VIEW
-  table->clear_column_bitmaps();
   table_list->table= table;
-  DBUG_ASSERT(table->key_read == 0);
-  /* Tables may be reused in a sub statement. */
-  DBUG_ASSERT(! table->file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN));
+
+  set_table_attributes_after_opening(thd, table_list, table);
+
   DBUG_RETURN(FALSE);
 
 err_lock:


Attachment: [text/bzr-bundle] bzr/alik@sun.com-20100819173824-vyig6gvsa8rqv9f0.bundle
Thread
bzr commit into mysql-5.5-bugfixing branch (alik:3114) Bug#27480Alexander Nozdrin19 Aug