List:Commits« Previous MessageNext Message »
From:eugene Date:February 16 2007 5:44pm
Subject:bk commit into 5.0 tree (evgen:1.2414)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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, 2007-02-16 19:44:54+03:00, evgen@stripped +2 -0
  Merge epotemkin@stripped:/home/bk/mysql-5.0-opt
  into  moonbone.local:/mnt/gentoo64/work/16630-bug-5.0-opt-mysql
  MERGE: 1.2377.33.1

  sql/item.cc@stripped, 2007-02-16 19:44:52+03:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.254.1.1

  sql/sql_select.cc@stripped, 2007-02-16 19:44:52+03:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.488.3.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:	evgen
# Host:	moonbone.local
# Root:	/mnt/gentoo64/work/16630-bug-5.0-opt-mysql/RESYNC

--- 1.256/sql/item.cc	2007-02-14 01:25:06 +03:00
+++ 1.257/sql/item.cc	2007-02-16 19:44:52 +03:00
@@ -4809,6 +4809,51 @@
 }
 
 
+/*
+  Add the field to the select list and substitute it for the reference to
+  the field.
+
+  SYNOPSIS
+    Item_field::update_value_transformer()
+    select_arg      current select
+
+  DESCRIPTION
+    If the field doesn't belong to the table being inserted into then it is
+    added to the select list, pointer to it is stored in the ref_pointer_array
+    of the select and the field itself is substituted for the Item_ref object.
+    This is done in order to get correct values from update fields that
+    belongs to the SELECT part in the INSERT .. SELECT .. ON DUPLICATE KEY
+    UPDATE statement.
+
+  RETURN
+    0             if error occured
+    ref           if all conditions are met
+    this field    otherwise
+*/
+
+Item *Item_field::update_value_transformer(byte *select_arg)
+{
+  SELECT_LEX *select= (SELECT_LEX*)select_arg;
+  DBUG_ASSERT(fixed);
+
+  if (field->table != select->context.table_list->table &&
+      type() != Item::TRIGGER_FIELD_ITEM)
+  {
+    List<Item> *all_fields= &select->join->all_fields;
+    Item **ref_pointer_array= select->ref_pointer_array;
+    int el= all_fields->elements;
+    Item_ref *ref;
+
+    ref_pointer_array[el]= (Item*)this;
+    all_fields->push_front((Item*)this);
+    ref= new Item_ref(&select->context, ref_pointer_array + el,
+                      table_name, field_name);
+    return ref;
+  }
+  return this;
+}
+
+
 Item_ref::Item_ref(Name_resolution_context *context_arg,
                    Item **item, const char *table_name_arg,
                    const char *field_name_arg)

--- 1.490/sql/sql_select.cc	2007-02-14 01:25:06 +03:00
+++ 1.491/sql/sql_select.cc	2007-02-16 19:44:52 +03:00
@@ -482,6 +482,9 @@
     }
   }
 
+  if (!procedure && result && result->prepare(fields_list, unit_arg))
+    goto err;					/* purecov: inspected */
+
   /* Init join struct */
   count_field_types(&tmp_table_param, all_fields, 0);
   ref_pointer_array_size= all_fields.elements*sizeof(Item*);
@@ -495,9 +498,6 @@
     goto err;
   }
 #endif
-  if (!procedure && result && result->prepare(fields_list, unit_arg))
-    goto err;					/* purecov: inspected */
-
   if (select_lex->olap == ROLLUP_TYPE && rollup_init())
     goto err;
   if (alloc_func_list())
Thread
bk commit into 5.0 tree (evgen:1.2414)eugene20 Feb