List:Commits« Previous MessageNext Message »
From:dlenev Date:February 27 2006 12:51pm
Subject:bk commit into 5.0 tree (dlenev:1.2083)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of dlenev. When dlenev 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.2083 06/02/27 15:51:39 dlenev@stripped +5 -0
  Merge bk-internal.mysql.com:/home/bk/mysql-5.0
  into  mysql.com:/home/dlenev/src/mysql-5.0-bg13525

  sql/sql_select.h
    1.107 06/02/27 15:51:34 dlenev@stripped +0 -2
    Manual merge.

  sql/sql_table.cc
    1.298 06/02/27 15:50:30 dlenev@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.529 06/02/27 15:50:30 dlenev@stripped +0 -0
    Auto merged

  sql/sql_base.cc
    1.329 06/02/27 15:50:29 dlenev@stripped +0 -0
    Auto merged

  sql/field.cc
    1.300 06/02/27 15:50:29 dlenev@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:	dlenev
# Host:	brandersnatch.site
# Root:	/home/dlenev/src/mysql-5.0-bg13525/RESYNC

--- 1.299/sql/field.cc	2006-02-24 00:11:57 +03:00
+++ 1.300/sql/field.cc	2006-02-27 15:50:29 +03:00
@@ -5262,7 +5262,7 @@
   }
 
   if (nr >= 19000000000000.0 && nr <= 99991231235959.0)
-    nr=floor(nr/1000000.0);			// Timestamp to date
+    nr= (longlong) floor(nr/1000000.0);         // Timestamp to date
 
   if (error)
     set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,

--- 1.328/sql/sql_base.cc	2006-02-23 16:21:34 +03:00
+++ 1.329/sql/sql_base.cc	2006-02-27 15:50:29 +03:00
@@ -368,6 +368,15 @@
   DESCRIPTION
     Marks all tables in the list which were used by current substatement
     (they are marked by its query_id) as free for reuse.
+
+  NOTE
+    The reason we reset query_id is that it's not enough to just test
+    if table->query_id != thd->query_id to know if a table is in use.
+
+    For example
+    SELECT f1_that_uses_t1() FROM t1;
+    In f1_that_uses_t1() we will see one instance of t1 where query_id is
+    set to query_id of original query.
 */
 
 static void mark_used_tables_as_free_for_reuse(THD *thd, TABLE *table)
@@ -678,11 +687,11 @@
 */
 
 TABLE_LIST *find_table_in_list(TABLE_LIST *table,
-                               uint offset,
+                               st_table_list *TABLE_LIST::*link,
                                const char *db_name,
                                const char *table_name)
 {
-  for (; table; table= *(TABLE_LIST **) ((char*) table + offset))
+  for (; table; table= table->*link )
   {
     if ((table->table == 0 || table->table->s->tmp_table == NO_TMP_TABLE) &&
         strcmp(table->db, db_name) == 0 &&

--- 1.528/sql/sql_parse.cc	2006-02-24 00:11:57 +03:00
+++ 1.529/sql/sql_parse.cc	2006-02-27 15:50:30 +03:00
@@ -1724,13 +1724,10 @@
       net->no_send_error= 0;
       /*
         Multiple queries exits, execute them individually
-	in embedded server - just store them to be executed later 
       */
-#ifndef EMBEDDED_LIBRARY
       if (thd->lock || thd->open_tables || thd->derived_tables ||
           thd->prelocked_mode)
         close_thread_tables(thd);
-#endif
       ulong length= (ulong)(packet_end-packet);
 
       log_slow_statement(thd);
@@ -1748,25 +1745,7 @@
       thd->set_time(); /* Reset the query start time. */
       /* TODO: set thd->lex->sql_command to SQLCOM_END here */
       VOID(pthread_mutex_unlock(&LOCK_thread_count));
-#ifndef EMBEDDED_LIBRARY
       mysql_parse(thd, packet, length);
-#else
-      /*
-	'packet' can point inside the query_rest's buffer
-	so we have to do memmove here
-       */
-      if (thd->query_rest.length() > length)
-      {
-	memmove(thd->query_rest.c_ptr(), packet, length);
-	thd->query_rest.length(length);
-      }
-      else
-	thd->query_rest.copy(packet, length, thd->query_rest.charset());
-
-      thd->server_status&= ~ (SERVER_QUERY_NO_INDEX_USED |
-                              SERVER_QUERY_NO_GOOD_INDEX_USED);
-      break;
-#endif /*EMBEDDED_LIBRARY*/
     }
 
     if (!(specialflag & SPECIAL_NO_PRIOR))
@@ -4273,10 +4252,8 @@
             goto error;
         }
 
-#ifndef EMBEDDED_LIBRARY
 	my_bool nsok= thd->net.no_send_ok;
 	thd->net.no_send_ok= TRUE;
-#endif
 	if (sp->m_flags & sp_head::MULTI_RESULTS)
 	{
 	  if (! (thd->client_capabilities & CLIENT_MULTI_RESULTS))
@@ -4286,9 +4263,7 @@
               back
             */
 	    my_error(ER_SP_BADSELECT, MYF(0), sp->m_qname.str);
-#ifndef EMBEDDED_LIBRARY
 	    thd->net.no_send_ok= nsok;
-#endif
 	    goto error;
 	  }
           /*
@@ -4305,18 +4280,14 @@
 				 sp->m_db.str, sp->m_name.str, TRUE, 0) ||
           sp_change_security_context(thd, sp, &save_ctx))
 	{
-#ifndef EMBEDDED_LIBRARY
 	  thd->net.no_send_ok= nsok;
-#endif
 	  goto error;
 	}
 	if (save_ctx &&
             check_routine_access(thd, EXECUTE_ACL,
                                  sp->m_db.str, sp->m_name.str, TRUE, 0))
 	{
-#ifndef EMBEDDED_LIBRARY
 	  thd->net.no_send_ok= nsok;
-#endif
 	  sp_restore_security_context(thd, save_ctx);
 	  goto error;
 	}
@@ -4348,9 +4319,7 @@
 	sp_restore_security_context(thd, save_ctx);
 #endif
 
-#ifndef EMBEDDED_LIBRARY
 	thd->net.no_send_ok= nsok;
-#endif
         thd->server_status&= ~bits_to_be_cleared;
 
 	if (!res)
@@ -4846,7 +4815,9 @@
     res= mysql_xa_recover(thd);
     break;
   default:
+#ifndef EMBEDDED_LIBRARY
     DBUG_ASSERT(0);                             /* Impossible */
+#endif
     send_ok(thd);
     break;
   }
@@ -6008,10 +5979,11 @@
     /*
       table_list.next points to the last inserted TABLE_LIST->next_local'
       element
+      We don't use the offsetof() macro here to avoid warnings from gcc
     */
-    previous_table_ref= (TABLE_LIST*) (table_list.next -
-                                       offsetof(TABLE_LIST, next_local));
-    DBUG_ASSERT(previous_table_ref);
+    previous_table_ref= (TABLE_LIST*) ((char*) table_list.next -
+                                       ((char*) &(ptr->next_local) -
+                                        (char*) ptr));
     /*
       Set next_name_resolution_table of the previous table reference to point
       to the current table reference. In effect the list

--- 1.106/sql/sql_select.h	2006-02-23 16:21:35 +03:00
+++ 1.107/sql/sql_select.h	2006-02-27 15:51:34 +03:00
@@ -104,6 +104,7 @@
 Next_select_func setup_end_select_func(JOIN *join);
 
 typedef struct st_join_table {
+  st_join_table() {}                          /* Remove gcc warning */
   TABLE		*table;
   KEYUSE	*keyuse;			/* pointer to first used key */
   SQL_SELECT	*select;
@@ -287,7 +288,6 @@
   {
     init(thd_arg, fields_arg, select_options_arg, result_arg);
   }
-
 
   void init(THD *thd_arg, List<Item> &fields_arg, ulonglong select_options_arg,
        select_result *result_arg)

--- 1.297/sql/sql_table.cc	2006-02-21 18:05:16 +03:00
+++ 1.298/sql/sql_table.cc	2006-02-27 15:50:30 +03:00
@@ -688,6 +688,12 @@
   {
     CHARSET_INFO *save_cs;
 
+    /*
+      Initialize length from its original value (number of characters),
+      which was set in the parser. This is necessary if we're
+      executing a prepared statement for the second time.
+    */
+    sql_field->length= sql_field->char_length;
     if (!sql_field->charset)
       sql_field->charset= create_info->default_table_charset;
     /*
@@ -872,7 +878,7 @@
 	  sql_field->charset=		(dup_field->charset ?
 					 dup_field->charset :
 					 create_info->default_table_charset);
-	  sql_field->length=		dup_field->chars_length;
+	  sql_field->length=		dup_field->char_length;
           sql_field->pack_length=	dup_field->pack_length;
           sql_field->key_length=	dup_field->key_length;
 	  sql_field->create_length_to_internal_length();
@@ -3289,6 +3295,13 @@
 	close_cached_table(thd, table);
 	if (mysql_rename_table(old_db_type,db,table_name,new_db,new_alias))
 	  error= -1;
+        else if (Table_triggers_list::change_table_name(thd, db, table_name,
+                                                        new_db, new_alias))
+        {
+          VOID(mysql_rename_table(old_db_type, new_db, new_alias, db,
+                                  table_name));
+          error= -1;
+        }
       }
       VOID(pthread_mutex_unlock(&LOCK_open));
     }
@@ -3837,7 +3850,11 @@
     VOID(quick_rm_table(new_db_type,new_db,tmp_name));
   }
   else if (mysql_rename_table(new_db_type,new_db,tmp_name,new_db,
-			      new_alias))
+			      new_alias) ||
+           (new_name != table_name || new_db != db) && // we also do rename
+           Table_triggers_list::change_table_name(thd, db, table_name,
+                                                  new_db, new_alias))
+       
   {						// Try to get everything back
     error=1;
     VOID(quick_rm_table(new_db_type,new_db,new_alias));
Thread
bk commit into 5.0 tree (dlenev:1.2083)dlenev27 Feb