List:Commits« Previous MessageNext Message »
From:konstantin Date:July 7 2006 6:09pm
Subject:bk commit into 5.0 tree (kostja:1.2219)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja 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@stripped, 2006-07-07 22:09:43+04:00, kostja@stripped +7 -0
  Merge bodhi.local:/opt/local/work/mysql-5.0-root
  into  bodhi.local:/opt/local/work/mysql-5.0-runtime
  MERGE: 1.2206.3.5

  sql/ha_ndbcluster.cc@stripped, 2006-07-07 22:08:40+04:00, kostja@stripped +0 -0
    Auto merged
    MERGE: 1.267.2.1

  sql/item.cc@stripped, 2006-07-07 22:08:40+04:00, kostja@stripped +0 -0
    Auto merged
    MERGE: 1.224.1.2

  sql/mysql_priv.h@stripped, 2006-07-07 22:08:40+04:00, kostja@stripped +0 -0
    Auto merged
    MERGE: 1.395.1.1

  sql/sql_parse.cc@stripped, 2006-07-07 22:08:40+04:00, kostja@stripped +0 -0
    Auto merged
    MERGE: 1.556.1.6

  sql/sql_table.cc@stripped, 2006-07-07 22:08:40+04:00, kostja@stripped +0 -0
    Auto merged
    MERGE: 1.316.1.1

  sql/sql_update.cc@stripped, 2006-07-07 22:09:41+04:00, kostja@stripped +3 -4
    Manual merge.
    MERGE: 1.191.2.1

  sql/sql_yacc.yy@stripped, 2006-07-07 22:08:41+04:00, kostja@stripped +0 -0
    Auto merged
    MERGE: 1.472.1.1

# 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:	kostja
# Host:	bodhi.local
# Root:	/opt/local/work/mysql-5.0-runtime/RESYNC

--- 1.226/sql/item.cc	2006-07-07 22:09:48 +04:00
+++ 1.227/sql/item.cc	2006-07-07 22:09:48 +04:00
@@ -5373,9 +5373,14 @@
 void Item_trigger_field::setup_field(THD *thd, TABLE *table,
                                      GRANT_INFO *table_grant_info)
 {
+  /*
+    There is no sense in marking fields used by trigger with current value
+    of THD::query_id since it is completely unrelated to the THD::query_id
+    value for statements which will invoke trigger. So instead we use
+    Table_triggers_list::mark_fields_used() method which is called during
+    execution of these statements.
+  */
   bool save_set_query_id= thd->set_query_id;
-
-  /* TODO: Think more about consequences of this step. */
   thd->set_query_id= 0;
   /*
     Try to find field by its name and if it will be found

--- 1.396/sql/mysql_priv.h	2006-07-07 22:09:48 +04:00
+++ 1.397/sql/mysql_priv.h	2006-07-07 22:09:48 +04:00
@@ -727,9 +727,7 @@
                        TABLE_LIST *table_list,
                        List<create_field> &fields,
                        List<Key> &keys,
-                       uint order_num, ORDER *order,
-                       enum enum_duplicates handle_duplicates,
-                       bool ignore,
+                       uint order_num, ORDER *order, bool ignore,
                        ALTER_INFO *alter_info, bool do_send_ok);
 bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool do_send_ok);
 bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
@@ -765,6 +763,8 @@
                   bool ignore);
 int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
                                            TABLE_LIST *table_list);
+void mark_fields_used_by_triggers_for_insert_stmt(THD *thd, TABLE *table,
+                                                  enum_duplicates duplic);
 bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
 bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
                   SQL_LIST *order, ha_rows rows, ulonglong options,

--- 1.558/sql/sql_parse.cc	2006-07-07 22:09:48 +04:00
+++ 1.559/sql/sql_parse.cc	2006-07-07 22:09:48 +04:00
@@ -1250,6 +1250,12 @@
   thd->version=refresh_version;
   thd->security_ctx->priv_user=
     thd->security_ctx->user= (char*) my_strdup("boot", MYF(MY_WME));
+  /*
+    Make the "client" handle multiple results. This is necessary
+    to enable stored procedures with SELECTs and Dynamic SQL
+    in init-file.
+  */
+  thd->client_capabilities|= CLIENT_MULTI_RESULTS;
 
   buff= (char*) thd->net.buff;
   thd->init_for_queries();
@@ -3083,8 +3089,7 @@
 			       lex->key_list,
 			       select_lex->order_list.elements,
                                (ORDER *) select_lex->order_list.first,
-			       lex->duplicates, lex->ignore, &lex->alter_info,
-                               1);
+			       lex->ignore, &lex->alter_info, 1);
       }
       break;
     }
@@ -3457,7 +3462,7 @@
   {
     DBUG_ASSERT(first_table == all_tables && first_table != 0);
     TABLE_LIST *aux_tables=
-      (TABLE_LIST *)thd->lex->auxilliary_table_list.first;
+      (TABLE_LIST *)thd->lex->auxiliary_table_list.first;
     multi_delete *result;
 
     if (!thd->locked_tables &&
@@ -5773,7 +5778,7 @@
   mysql_init_select(lex);
   lex->select_lex.select_limit= 0;
   lex->unit.select_limit_cnt= HA_POS_ERROR;
-  lex->select_lex.table_list.save_and_clear(&lex->auxilliary_table_list);
+  lex->select_lex.table_list.save_and_clear(&lex->auxiliary_table_list);
   lex->lock_option= using_update_log ? TL_READ_NO_INSERT : TL_READ;
   lex->query_tables= 0;
   lex->query_tables_last= &lex->query_tables;
@@ -7033,7 +7038,7 @@
   DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->table_name,
 				&create_info, table_list,
 				fields, keys, 0, (ORDER*)0,
-				DUP_ERROR, 0, &alter_info, 1));
+                                0, &alter_info, 1));
 }
 
 
@@ -7051,7 +7056,7 @@
   DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->table_name,
 				&create_info, table_list,
 				fields, keys, 0, (ORDER*)0,
-				DUP_ERROR, 0, alter_info, 1));
+                                0, alter_info, 1));
 }
 
 
@@ -7152,7 +7157,7 @@
 {
   SELECT_LEX *select_lex= &thd->lex->select_lex;
   TABLE_LIST *aux_tables=
-    (TABLE_LIST *)thd->lex->auxilliary_table_list.first;
+    (TABLE_LIST *)thd->lex->auxiliary_table_list.first;
   TABLE_LIST **save_query_tables_own_last= thd->lex->query_tables_own_last;
   DBUG_ENTER("multi_delete_precheck");
 
@@ -7206,7 +7211,7 @@
 
   lex->table_count= 0;
 
-  for (target_tbl= (TABLE_LIST *)lex->auxilliary_table_list.first;
+  for (target_tbl= (TABLE_LIST *)lex->auxiliary_table_list.first;
        target_tbl; target_tbl= target_tbl->next_local)
   {
     lex->table_count++;

--- 1.317/sql/sql_table.cc	2006-07-07 22:09:48 +04:00
+++ 1.318/sql/sql_table.cc	2006-07-07 22:09:48 +04:00
@@ -35,9 +35,7 @@
 static bool check_if_keyname_exists(const char *name,KEY *start, KEY *end);
 static char *make_unique_key_name(const char *field_name,KEY *start,KEY *end);
 static int copy_data_between_tables(TABLE *from,TABLE *to,
-				    List<create_field> &create,
-				    enum enum_duplicates handle_duplicates,
-                                    bool ignore,
+                                    List<create_field> &create, bool ignore,
 				    uint order_num, ORDER *order,
 				    ha_rows *copied,ha_rows *deleted);
 static bool prepare_blob_field(THD *thd, create_field *sql_field);
@@ -3141,8 +3139,7 @@
                        HA_CREATE_INFO *create_info,
                        TABLE_LIST *table_list,
                        List<create_field> &fields, List<Key> &keys,
-                       uint order_num, ORDER *order,
-                       enum enum_duplicates handle_duplicates, bool ignore,
+                       uint order_num, ORDER *order, bool ignore,
                        ALTER_INFO *alter_info, bool do_send_ok)
 {
   TABLE *table,*new_table=0;
@@ -3740,8 +3737,7 @@
   {
     new_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
     new_table->next_number_field=new_table->found_next_number_field;
-    error=copy_data_between_tables(table,new_table,create_list,
-				   handle_duplicates, ignore,
+    error=copy_data_between_tables(table, new_table, create_list, ignore,
 				   order_num, order, &copied, &deleted);
   }
   thd->last_insert_id=next_insert_id;		// Needed for correct log
@@ -3964,7 +3960,6 @@
 static int
 copy_data_between_tables(TABLE *from,TABLE *to,
 			 List<create_field> &create,
-			 enum enum_duplicates handle_duplicates,
                          bool ignore,
 			 uint order_num, ORDER *order,
 			 ha_rows *copied,
@@ -4067,8 +4062,7 @@
   */
   from->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
   init_read_record(&info, thd, from, (SQL_SELECT *) 0, 1,1);
-  if (ignore ||
-      handle_duplicates == DUP_REPLACE)
+  if (ignore)
     to->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
   thd->row_count= 0;
   restore_record(to, s->default_values);        // Create empty record
@@ -4095,8 +4089,7 @@
     }
     if ((error=to->file->write_row((byte*) to->record[0])))
     {
-      if ((!ignore &&
-	   handle_duplicates != DUP_REPLACE) ||
+      if (!ignore ||
 	  (error != HA_ERR_FOUND_DUPP_KEY &&
 	   error != HA_ERR_FOUND_DUPP_UNIQUE))
       {
@@ -4174,7 +4167,7 @@
   DBUG_RETURN(mysql_alter_table(thd, NullS, NullS, &create_info,
                                 table_list, lex->create_list,
                                 lex->key_list, 0, (ORDER *) 0,
-                                DUP_ERROR, 0, &lex->alter_info, do_send_ok));
+                                0, &lex->alter_info, do_send_ok));
 }
 
 

--- 1.193/sql/sql_update.cc	2006-07-07 22:09:48 +04:00
+++ 1.194/sql/sql_update.cc	2006-07-07 22:09:48 +04:00
@@ -434,13 +434,15 @@
                                (MODE_STRICT_TRANS_TABLES |
                                 MODE_STRICT_ALL_TABLES)));
 
+  if (table->triggers)
+    table->triggers->mark_fields_used(thd, TRG_EVENT_UPDATE);
+
   /*
     We can use compare_record() to optimize away updates if
     the table handler is returning all columns
   */
   can_compare_record= !(table->file->table_flags() &
                         HA_PARTIAL_COLUMN_READ);
-                       
   while (!(error=info.read_record(&info)) && !thd->killed)
   {
     if (!(select && select->skip_record()))
@@ -762,6 +764,9 @@
         my_error(ER_NON_UPDATABLE_TABLE, MYF(0), tl->alias, "UPDATE");
         DBUG_RETURN(TRUE);
       }
+
+      if (table->triggers)
+        table->triggers->mark_fields_used(thd, TRG_EVENT_UPDATE);
 
       DBUG_PRINT("info",("setting table `%s` for update", tl->alias));
       /*

--- 1.473/sql/sql_yacc.yy	2006-07-07 22:09:48 +04:00
+++ 1.474/sql/sql_yacc.yy	2006-07-07 22:09:48 +04:00
@@ -4453,7 +4453,10 @@
 	    Lex->safe_to_cache_query=0;
 	  }
 	| CURRENT_USER optional_braces
-          { $$= create_func_current_user(); }
+          {
+            $$= new Item_func_current_user(Lex->current_context());
+            Lex->safe_to_cache_query= 0;
+          }
 	| DATE_ADD_INTERVAL '(' expr ',' interval_expr interval ')'
 	  { $$= new Item_date_add_interval($3,$5,$6,0); }
 	| DATE_SUB_INTERVAL '(' expr ',' interval_expr interval ')'
@@ -4810,7 +4813,7 @@
 	| UNIX_TIMESTAMP '(' expr ')'
 	  { $$= new Item_func_unix_timestamp($3); }
 	| USER '(' ')'
-	  { $$= new Item_func_user(FALSE); Lex->safe_to_cache_query=0; }
+	  { $$= new Item_func_user(); Lex->safe_to_cache_query=0; }
 	| UTC_DATE_SYM optional_braces
 	  { $$= new Item_func_curdate_utc(); Lex->safe_to_cache_query=0;}
 	| UTC_TIME_SYM optional_braces

--- 1.271/sql/ha_ndbcluster.cc	2006-07-07 22:09:48 +04:00
+++ 1.272/sql/ha_ndbcluster.cc	2006-07-07 22:09:48 +04:00
@@ -3217,20 +3217,11 @@
     break;
   case HA_EXTRA_IGNORE_DUP_KEY:       /* Dup keys don't rollback everything*/
     DBUG_PRINT("info", ("HA_EXTRA_IGNORE_DUP_KEY"));
-    if (current_thd->lex->sql_command == SQLCOM_REPLACE && !m_has_unique_index)
-    {
-      DBUG_PRINT("info", ("Turning ON use of write instead of insert"));
-      m_use_write= TRUE;
-    } else 
-    {
-      DBUG_PRINT("info", ("Ignoring duplicate key"));
-      m_ignore_dup_key= TRUE;
-    }
+    DBUG_PRINT("info", ("Ignoring duplicate key"));
+    m_ignore_dup_key= TRUE;
     break;
   case HA_EXTRA_NO_IGNORE_DUP_KEY:
     DBUG_PRINT("info", ("HA_EXTRA_NO_IGNORE_DUP_KEY"));
-    DBUG_PRINT("info", ("Turning OFF use of write instead of insert"));
-    m_use_write= FALSE;
     m_ignore_dup_key= FALSE;
     break;
   case HA_EXTRA_RETRIEVE_ALL_COLS:    /* Retrieve all columns, not just those
@@ -3260,7 +3251,19 @@
   case HA_EXTRA_KEYREAD_PRESERVE_FIELDS:
     DBUG_PRINT("info", ("HA_EXTRA_KEYREAD_PRESERVE_FIELDS"));
     break;
-
+  case HA_EXTRA_WRITE_CAN_REPLACE:
+    DBUG_PRINT("info", ("HA_EXTRA_WRITE_CAN_REPLACE"));
+    if (!m_has_unique_index)
+    {
+      DBUG_PRINT("info", ("Turning ON use of write instead of insert"));
+      m_use_write= TRUE;
+    }
+    break;
+  case HA_EXTRA_WRITE_CANNOT_REPLACE:
+    DBUG_PRINT("info", ("HA_EXTRA_WRITE_CANNOT_REPLACE"));
+    DBUG_PRINT("info", ("Turning OFF use of write instead of insert"));
+    m_use_write= FALSE;
+    break;
   }
   
   DBUG_RETURN(0);
Thread
bk commit into 5.0 tree (kostja:1.2219)konstantin7 Jul