List:Commits« Previous MessageNext Message »
From:Jim Winstead Date:August 11 2006 7:19pm
Subject:bk commit into 5.1 tree (jimw:1.2272)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jimw. When jimw 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-08-11 12:19:41-07:00, jimw@rama.(none) +2 -0
  Merge rama.(none):/home/jimw/my/mysql-5.0-21284
  into  rama.(none):/home/jimw/my/mysql-5.1-clean
  MERGE: 1.1810.1696.95

  sql/field.h@stripped, 2006-08-11 12:19:38-07:00, jimw@rama.(none) +0 -0
    Resolve conflict
    MERGE: 1.153.1.33

  sql/ha_federated.cc@stripped, 2006-08-11 12:19:38-07:00, jimw@rama.(none) +25 -33
    Resolve conflict
    MERGE: 1.24.1.44

# 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:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.1-clean/RESYNC

--- 1.196/sql/field.h	2006-08-11 12:19:46 -07:00
+++ 1.197/sql/field.h	2006-08-11 12:19:46 -07:00
@@ -118,6 +118,11 @@ public:
   */
   virtual String *val_str(String*,String *)=0;
   String *val_int_as_str(String *val_buffer, my_bool unsigned_flag);
+  /*
+   str_needs_quotes() returns TRUE if the value returned by val_str() needs
+   to be quoted when used in constructing an SQL query.
+  */
+  virtual bool str_needs_quotes() { return FALSE; }
   virtual Item_result result_type () const=0;
   virtual Item_result cmp_type () const { return result_type(); }
   virtual Item_result cast_to_int_type () const { return result_type(); }
@@ -412,6 +417,7 @@ public:
   uint32 max_length() { return field_length; }
   friend class create_field;
   my_decimal *val_decimal(my_decimal *);
+  virtual bool str_needs_quotes() { return TRUE; }
   uint is_equal(create_field *new_field);
 };
 
@@ -1379,6 +1385,7 @@ public:
   double val_real(void);
   longlong val_int(void);
   String *val_str(String*, String *);
+  virtual bool str_needs_quotes() { return TRUE; }
   my_decimal *val_decimal(my_decimal *);
   int cmp(const char *a, const char *b)
   { return cmp_binary(a, b); }

--- 1.71/sql/ha_federated.cc	2006-08-11 12:19:46 -07:00
+++ 1.72/sql/ha_federated.cc	2006-08-11 12:19:46 -07:00
@@ -1142,7 +1142,7 @@ bool ha_federated::create_where_from_key
       Field *field= key_part->field;
       uint store_length= key_part->store_length;
       uint part_length= min(store_length, length);
-      needs_quotes= 1;
+      needs_quotes= field->str_needs_quotes();
       DBUG_DUMP("key, start of loop", (char *) ptr, length);
 
       if (key_part->null_bit)
@@ -1663,23 +1663,22 @@ int ha_federated::write_row(byte *buf)
     {
       commas_added= TRUE;
       if ((*field)->is_null())
-        insert_field_value_string.append(STRING_WITH_LEN(" NULL "));
+        values_string.append(STRING_WITH_LEN(" NULL "));
       else
       {
+        bool needs_quote= (*field)->str_needs_quotes();
         (*field)->val_str(&insert_field_value_string);
-        values_string.append('\'');
+        if (needs_quote)
+          values_string.append('\'');
         insert_field_value_string.print(&values_string);
-        values_string.append('\'');
+        if (needs_quote)
+          values_string.append('\'');
 
         insert_field_value_string.length(0);
       }
       /* append the field name */
       insert_string.append((*field)->field_name);
 
-      /* append the value */
-      values_string.append(insert_field_value_string);
-      insert_field_value_string.length(0);
-
       /* append commas between both fields and fieldnames */
       /*
         unfortunately, we can't use the logic if *(fields + 1) to
@@ -1884,12 +1883,15 @@ int ha_federated::update_row(const byte 
         update_string.append(STRING_WITH_LEN(" NULL "));
       else
       {
-        my_bitmap_map *old_map= tmp_use_all_columns(table, table->read_set);
         /* otherwise = */
+        my_bitmap_map *old_map= tmp_use_all_columns(table, table->read_set);
+        bool needs_quote= (*field)->str_needs_quotes();
 	(*field)->val_str(&field_value);
-        update_string.append('\'');
+        if (needs_quote)
+          update_string.append('\'');
         field_value.print(&update_string);
-        update_string.append('\'');
+        if (needs_quote)
+          update_string.append('\'');
         field_value.length(0);
         tmp_restore_column_map(table->read_set, old_map);
       }
@@ -1903,12 +1905,15 @@ int ha_federated::update_row(const byte 
         where_string.append(STRING_WITH_LEN(" IS NULL "));
       else
       {
+        bool needs_quote= (*field)->str_needs_quotes();
         where_string.append(STRING_WITH_LEN(" = "));
         (*field)->val_str(&field_value,
                           (char*) (old_data + (*field)->offset()));
-	where_string.append('\'');
+        if (needs_quote)
+          where_string.append('\'');
         field_value.print(&where_string);
-	where_string.append('\'');
+        if (needs_quote)
+          where_string.append('\'');
         field_value.length(0);
       }
       where_string.append(STRING_WITH_LEN(" AND "));
@@ -1983,11 +1988,14 @@ int ha_federated::delete_row(const byte 
       }
       else
       {
-      delete_string.append(STRING_WITH_LEN(" = "));
-      cur_field->val_str(&data_string);
-      delete_string.append('\'');
-      data_string.print(&delete_string);
-      delete_string.append('\'');
+        bool needs_quote= cur_field->str_needs_quotes();
+        delete_string.append(STRING_WITH_LEN(" = "));
+        cur_field->val_str(&data_string);
+        if (needs_quote)
+          delete_string.append('\'');
+        data_string.print(&delete_string);
+        if (needs_quote)
+          delete_string.append('\'');
       }
       delete_string.append(STRING_WITH_LEN(" AND "));
     }
Thread
bk commit into 5.1 tree (jimw:1.2272)Jim Winstead11 Aug