List:Internals« Previous MessageNext Message »
From:monty Date:June 29 2005 9:44am
Subject:bk commit into 5.0 tree (monty:1.1981)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of monty. When monty 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.1981 05/06/29 12:44:40 monty@stripped +3 -0
  Simple optimization
  nsure that delete works not only on table->record[0] for federated tables

  sql/opt_range.cc
    1.176 05/06/29 12:44:31 monty@stripped +5 -7
    Simplify code

  sql/ha_federated.cc
    1.30 05/06/29 12:44:31 monty@stripped +10 -14
    Simple optimizations
    Ensure that delete works not only on table->record[0]

  sql/field.cc
    1.269 05/06/29 12:44:31 monty@stripped +6 -1
    Test OOM condition

# 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:	monty
# Host:	narttu.mysql.com
# Root:	/home/my/mysql-5.0

--- 1.268/sql/field.cc	2005-06-24 11:13:45 +03:00
+++ 1.269/sql/field.cc	2005-06-29 12:44:31 +03:00
@@ -6822,7 +6822,12 @@
 						  &not_used)))
     { 
       uint conv_errors;
-      tmpstr.copy(from, length, cs, field_charset, &conv_errors);
+      if (tmpstr.copy(from, length, cs, field_charset, &conv_errors))
+      {
+        /* Fatal OOM error */
+        bzero(ptr,Field_blob::pack_length());
+        return -1;
+      }
       from= tmpstr.ptr();
       length=  tmpstr.length();
       if (conv_errors)

--- 1.175/sql/opt_range.cc	2005-06-23 17:23:41 +03:00
+++ 1.176/sql/opt_range.cc	2005-06-29 12:44:31 +03:00
@@ -8556,23 +8556,21 @@
 
     if ((result == HA_ERR_KEY_NOT_FOUND) && (cur_range->flag & EQ_RANGE))
       continue; /* Check the next range. */
-    else if (result)
+    if (result)
+    {
       /*
         In no key was found with this upper bound, there certainly are no keys
         in the ranges to the left.
       */
       return result;
-
+    }
     /* A key was found. */
     if (cur_range->flag & EQ_RANGE)
-      return result; /* No need to perform the checks below for equal keys. */
+      return 0; /* No need to perform the checks below for equal keys. */
 
     /* Check if record belongs to the current group. */
     if (key_cmp(index_info->key_part, group_prefix, real_prefix_len))
-    {
-      result = HA_ERR_KEY_NOT_FOUND;
-      continue;
-    }
+      continue;                                 // Row not found
 
     /* If there is a lower limit, check if the found key is in the range. */
     if ( !(cur_range->flag & NO_MIN_RANGE) )

--- 1.29/sql/ha_federated.cc	2005-06-22 20:22:09 +03:00
+++ 1.30/sql/ha_federated.cc	2005-06-29 12:44:31 +03:00
@@ -1399,27 +1399,25 @@
 
 int ha_federated::delete_row(const byte *buf)
 {
-  uint x= 0;
   char delete_buffer[IO_SIZE];
   char data_buffer[IO_SIZE];
-
   String delete_string(delete_buffer, sizeof(delete_buffer), &my_charset_bin);
-  delete_string.length(0);
   String data_string(data_buffer, sizeof(data_buffer), &my_charset_bin);
-  data_string.length(0);
-
   DBUG_ENTER("ha_federated::delete_row");
 
+  delete_string.length(0);
   delete_string.append("DELETE FROM `");
   delete_string.append(share->table_base_name);
   delete_string.append("`");
   delete_string.append(" WHERE ");
 
-  for (Field **field= table->field; *field; field++, x++)
+  for (Field **field= table->field; *field; field++)
   {
-    delete_string.append((*field)->field_name);
+    Field *cur_field= *field;
+    data_string.length(0);
+    delete_string.append(cur_field->field_name);
 
-    if ((*field)->is_null())
+    if (cur_field->is_null_in_record((const uchar*) buf))
     {
       delete_string.append(" IS ");
       data_string.append("NULL");
@@ -1427,17 +1425,15 @@
     else
     {
       delete_string.append("=");
-      (*field)->val_str(&data_string);
-      (*field)->quote_data(&data_string);
+      cur_field->val_str(&data_string, (char*) buf+ cur_field->offset());
+      cur_field->quote_data(&data_string);
     }
 
     delete_string.append(data_string);
-    data_string.length(0);
-
-    if (x + 1 < table->s->fields)
-      delete_string.append(" AND ");
+    delete_string.append(" AND ");
   }
 
+  delete_string.length(delete_string.length()-5); // Remove AND
   delete_string.append(" LIMIT 1");
   DBUG_PRINT("info",
              ("Delete sql: %s", delete_string.c_ptr_quick()));
Thread
bk commit into 5.0 tree (monty:1.1981)monty29 Jun