Commit 79072b50 authored by unknown's avatar unknown
Browse files

Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1-new-maint

into  zim.(none):/home/brian/mysql/remove-bdb-5.1

parents bcc3b17f 3662bc59
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -118,6 +118,11 @@ class Field
  */
  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 @@ class Field_str :public Field {
  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 @@ class Field_bit :public Field {
  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); }
+26 −18
Original line number Diff line number Diff line
@@ -1142,7 +1142,7 @@ bool ha_federated::create_where_from_key(String *to,
      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,12 +1663,15 @@ 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);
        if (needs_quote)
          values_string.append('\'');
        insert_field_value_string.print(&values_string);
        if (needs_quote)
          values_string.append('\'');

        insert_field_value_string.length(0);
@@ -1676,10 +1679,6 @@ int ha_federated::write_row(byte *buf)
      /* 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,11 +1883,14 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
        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);
        if (needs_quote)
          update_string.append('\'');
        field_value.print(&update_string);
        if (needs_quote)
          update_string.append('\'');
        field_value.length(0);
        tmp_restore_column_map(table->read_set, old_map);
@@ -1903,11 +1905,14 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
        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()));
        if (needs_quote)
          where_string.append('\'');
        field_value.print(&where_string);
        if (needs_quote)
          where_string.append('\'');
        field_value.length(0);
      }
@@ -1983,10 +1988,13 @@ int ha_federated::delete_row(const byte *buf)
      }
      else
      {
        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 "));
+5204 −5099

File changed.

Preview size limit exceeded, changes collapsed.