List:Internals« Previous MessageNext Message »
From:Sasha Pachev Date:September 14 2005 12:37pm
Subject:bk commit into 4.1 tree (sasha:1.2434)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of sasha. When sasha does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2434 05/09/14 06:37:52 sasha@stripped +1 -0
  Merge spachev@stripped:/home/bk/mysql-4.1
  into  asksasha.com:/reiser-data/mysql-dev/mysql-4.1-bug11139

  sql/sql_parse.cc
    1.467 05/09/14 06:37:45 sasha@stripped +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	sasha
# Host:	mysql.sashanet.com
# Root:	/reiser-data/mysql-dev/mysql-4.1-bug11139/RESYNC

--- 1.466/sql/sql_parse.cc	2005-09-10 16:57:22 -06:00
+++ 1.467/sql/sql_parse.cc	2005-09-14 06:37:45 -06:00
@@ -59,6 +59,9 @@
 static void refresh_status(void);
 static bool append_file_to_dir(THD *thd, const char **filename_ptr,
 			       const char *table_name);
+             
+static TABLE_LIST* get_table_by_alias(TABLE_LIST* tl, const char* db,
+  const char* alias);      
 
 const char *any_db="*any*";	// Special symbol for check_access
 
@@ -125,10 +128,7 @@
 */
 inline bool all_tables_not_ok(THD *thd, TABLE_LIST *tables)
 {
-  return (table_rules_on && tables && !tables_ok(thd,tables) &&
-          ((thd->lex->sql_command != SQLCOM_DELETE_MULTI) ||
-           !tables_ok(thd,
-		      (TABLE_LIST *)thd->lex->auxilliary_table_list.first)));
+  return (table_rules_on && tables && !tables_ok(thd,tables));
 }
 #endif
 
@@ -4245,6 +4245,40 @@
   DBUG_VOID_RETURN;
 }
 
+static TABLE_LIST* get_table_by_alias(TABLE_LIST* tl, const char* db,
+  const char* alias)
+{
+  for (;tl;tl= tl->next)
+  {
+    if (!strcmp(db,tl->db) &&
+        tl->alias && !my_strcasecmp(table_alias_charset,tl->alias,alias))
+      return tl;
+  }
+  
+  return 0;
+}     
+
+/* Sets up lex->auxilliary_table_list */
+void fix_multi_delete_lex(LEX* lex)
+{
+  TABLE_LIST *tl;
+  TABLE_LIST *good_list= (TABLE_LIST*)lex->select_lex.table_list.first;
+  
+  for (tl= (TABLE_LIST*)lex->auxilliary_table_list.first; tl; tl= tl->next)
+  {
+    TABLE_LIST* good_table= get_table_by_alias(good_list,tl->db,tl->alias);
+    if (good_table && !good_table->derived)
+    {
+      /* 
+          real_name points to a member of Table_ident which is
+          allocated via thd->strmake() from THD memroot 
+       */
+      tl->real_name= good_table->real_name;
+      tl->real_name_length= good_table->real_name_length;
+      good_table->updating= tl->updating;
+    }
+  }
+}  
 
 void mysql_init_multi_delete(LEX *lex)
 {
@@ -5567,13 +5601,7 @@
     (*table_count)++;
     /* All tables in aux_tables must be found in FROM PART */
     TABLE_LIST *walk;
-    for (walk= delete_tables; walk; walk= walk->next)
-    {
-      if (!my_strcasecmp(table_alias_charset,
-			 target_tbl->alias, walk->alias) &&
-	  !strcmp(walk->db, target_tbl->db))
-	break;
-    }
+    walk= get_table_by_alias(delete_tables,target_tbl->db,target_tbl->alias);
     if (!walk)
     {
       my_error(ER_UNKNOWN_TABLE, MYF(0), target_tbl->real_name,
Thread
bk commit into 4.1 tree (sasha:1.2434)Sasha Pachev14 Sep