List:Commits« Previous MessageNext Message »
From:Sergei Golubchik Date:January 3 2006 5:12pm
Subject:bk commit into 5.0 tree (serg:1.2010)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of serg. When serg 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.2010 06/01/03 18:12:03 serg@stripped +11 -0
  merged

  sql/item.cc
    1.202 06/01/03 18:11:52 serg@stripped +1 -4
    merged

  sql/sql_show.cc
    1.304 06/01/03 18:04:34 serg@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.520 06/01/03 18:04:34 serg@stripped +0 -0
    Auto merged

  sql/sql_insert.cc
    1.182 06/01/03 18:04:33 serg@stripped +0 -0
    Auto merged

  sql/sql_db.cc
    1.122 06/01/03 18:04:33 serg@stripped +0 -0
    Auto merged

  sql/sql_acl.cc
    1.187 06/01/03 18:04:32 serg@stripped +0 -0
    Auto merged

  sql/opt_range.cc
    1.202 06/01/03 18:04:32 serg@stripped +0 -0
    Auto merged

  sql/item_func.cc
    1.271 06/01/03 18:04:31 serg@stripped +0 -0
    Auto merged

  sql/field.h
    1.171 06/01/03 18:04:31 serg@stripped +0 -0
    Auto merged

  sql/field.cc
    1.296 06/01/03 18:04:31 serg@stripped +0 -0
    Auto merged

  myisam/mi_delete.c
    1.38 06/01/03 18:04:30 serg@stripped +0 -0
    Auto merged

# 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:	serg
# Host:	serg.mylan
# Root:	/usr/home/serg/Abk/mysql-5.0/RESYNC

--- 1.37/myisam/mi_delete.c	Tue Dec 27 14:56:46 2005
+++ 1.38/myisam/mi_delete.c	Tue Jan  3 18:04:30 2006
@@ -276,7 +276,8 @@ static int d_search(register MI_INFO *in
       if (subkeys == -1)
       {
         /* the last entry in sub-tree */
-        _mi_dispose(info, keyinfo, root,DFLT_INIT_HITS);
+        if (_mi_dispose(info, keyinfo, root,DFLT_INIT_HITS))
+          DBUG_RETURN(-1);
         /* fall through to normal delete */
       }
       else

--- 1.295/sql/field.cc	Wed Dec  7 15:02:38 2005
+++ 1.296/sql/field.cc	Tue Jan  3 18:04:31 2006
@@ -1570,7 +1570,6 @@ Field *Field::new_key_field(MEM_ROOT *ro
 bool Field::quote_data(String *unquoted_string)
 {
   char escaped_string[IO_SIZE];
-  char *unquoted_string_buffer= (char *)(unquoted_string->ptr());
   DBUG_ENTER("Field::quote_data");
 
   if (!needs_quotes())
@@ -4541,8 +4540,6 @@ int Field_timestamp::store(const char *f
       error= 1;
     }
   }
-  if (error > 1)
-    error= 2;
 
 #ifdef WORDS_BIGENDIAN
   if (table->s->db_low_byte_first)
@@ -7067,7 +7064,7 @@ void Field_blob::get_key_image(char *buf
     }
     get_ptr(&blob);
     gobj= Geometry::construct(&buffer, blob, blob_length);
-    if (gobj->get_mbr(&mbr, &dummy))
+    if (!gobj || gobj->get_mbr(&mbr, &dummy))
       bzero(buff, SIZEOF_STORED_DOUBLE*4);
     else
     {
@@ -7396,7 +7393,7 @@ void Field_geom::get_key_image(char *buf
   }
   get_ptr(&blob);
   gobj= Geometry::construct(&buffer, blob, blob_length);
-  if (gobj->get_mbr(&mbr, &dummy))
+  if (!gobj || gobj->get_mbr(&mbr, &dummy))
     bzero(buff, SIZEOF_STORED_DOUBLE*4);
   else
   {
@@ -8154,17 +8151,14 @@ const char *Field_bit::unpack(char *to, 
 */
 
 Field_bit_as_char::Field_bit_as_char(char *ptr_arg, uint32 len_arg,
-                                     uchar *null_ptr_arg, uchar null_bit_arg, 
-                                     uchar *bit_ptr_arg, uchar bit_ofs_arg, 
-                                     enum utype unireg_check_arg, 
+                                     uchar *null_ptr_arg, uchar null_bit_arg,
+                                     enum utype unireg_check_arg,
                                      const char *field_name_arg,
                                      struct st_table *table_arg)
-  : Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, bit_ptr_arg,
-              bit_ofs_arg, unireg_check_arg, field_name_arg, table_arg),
+  : Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 0,
+              0, unireg_check_arg, field_name_arg, table_arg),
     create_length(len_arg)
 {
-  bit_ptr= 0;
-  bit_ofs= 0;
   bit_len= 0;
   field_length= ((len_arg + 7) & ~7) / 8;
 }
@@ -8865,8 +8859,8 @@ Field *make_field(char *ptr, uint32 fiel
     return new Field_null(ptr,field_length,unireg_check,field_name,table, field_charset);
   case FIELD_TYPE_BIT:
     return f_bit_as_char(pack_flag) ?
-           new Field_bit_as_char(ptr, field_length, null_pos, null_bit, bit_ptr,
-                                 bit_offset, unireg_check, field_name, table) :
+           new Field_bit_as_char(ptr, field_length, null_pos, null_bit,
+                                 unireg_check, field_name, table) :
            new Field_bit(ptr, field_length, null_pos, null_bit, bit_ptr,
                          bit_offset, unireg_check, field_name, table);
   default:					// Impossible (Wrong version)

--- 1.170/sql/field.h	Wed Dec  7 15:01:07 2005
+++ 1.171/sql/field.h	Tue Jan  3 18:04:31 2006
@@ -1348,12 +1348,12 @@ public:
   }
 };
 
-  
+
 class Field_bit_as_char: public Field_bit {
 public:
   uchar create_length;
   Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
-                    uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
+                    uchar null_bit_arg,
                     enum utype unireg_check_arg, const char *field_name_arg,
                     struct st_table *table_arg);
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }

--- 1.201/sql/item.cc	Wed Dec 21 15:17:45 2005
+++ 1.202/sql/item.cc	Tue Jan  3 18:11:52 2006
@@ -985,7 +985,7 @@ Item_case_expr::this_item_addr(THD *thd,
 
 void Item_case_expr::print(String *str)
 {
-  str->append(STRING_WITH_LEN("case_expr@"));
+  VOID(str->append(STRING_WITH_LEN("case_expr@")));
   str->qs_append(m_case_expr_id);
 }
 
@@ -3843,7 +3843,7 @@ Field *Item::tmp_table_field_from_field_
     return new Field_year((char*) 0, max_length, null_ptr, 0, Field::NONE,
 			  name, table);
   case MYSQL_TYPE_BIT:
-    return new Field_bit_as_char(NULL, max_length, null_ptr, 0, NULL, 0,
+    return new Field_bit_as_char(NULL, max_length, null_ptr, 0,
                                  Field::NONE, name, table);
   default:
     /* This case should never be chosen */

--- 1.270/sql/item_func.cc	Sun Dec 11 08:30:51 2005
+++ 1.271/sql/item_func.cc	Tue Jan  3 18:04:31 2006
@@ -888,7 +888,7 @@ String *Item_decimal_typecast::val_str(S
   my_decimal tmp_buf, *tmp= val_decimal(&tmp_buf);
   if (null_value)
     return NULL;
-  my_decimal2string(E_DEC_FATAL_ERROR, &tmp_buf, 0, 0, 0, str);
+  my_decimal2string(E_DEC_FATAL_ERROR, tmp, 0, 0, 0, str);
   return str;
 }
 
@@ -4709,7 +4709,7 @@ Item_func_sp::sp_result_field(void) cons
   {
     char *empty_name= (char *) "";
     TABLE_SHARE *share;
-    dummy_table->s= share= &dummy_table->share_not_to_be_used;      
+    dummy_table->s= share= &dummy_table->share_not_to_be_used;
     dummy_table->alias = empty_name;
     dummy_table->maybe_null = maybe_null;
     dummy_table->in_use= current_thd;
@@ -4742,8 +4742,13 @@ Item_func_sp::execute(Field **flp)
   
   if (!(f= *flp))
   {
-    *flp= f= sp_result_field();
-    f->move_field((f->pack_length() > sizeof(result_buf)) ? 
+    if (!(*flp= f= sp_result_field()))
+    {
+      my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+      return 0;
+    }
+
+    f->move_field((f->pack_length() > sizeof(result_buf)) ?
                   sql_alloc(f->pack_length()) : result_buf);
     f->null_ptr= (uchar *)&null_value;
     f->null_bit= 1;

--- 1.201/sql/opt_range.cc	Fri Dec  2 16:27:13 2005
+++ 1.202/sql/opt_range.cc	Tue Jan  3 18:04:32 2006
@@ -652,7 +652,6 @@ SQL_SELECT *make_select(TABLE *head, tab
 			table_map read_tables, COND *conds,
                         bool allow_null_cond,
                         int *error)
-                        
 {
   SQL_SELECT *select;
   DBUG_ENTER("make_select");
@@ -5775,10 +5774,7 @@ QUICK_RANGE_SELECT *get_quick_select_for
   if (!quick)
     return 0;			/* no ranges found */
   if (quick->init())
-  {
-    delete quick;
     goto err;
-  }
   quick->records= records;
 
   if (cp_buffer_from_ref(thd,ref) && thd->is_fatal_error ||
@@ -7112,7 +7108,7 @@ get_best_group_min_max(PARAM *param, SEL
   ha_rows cur_records;
   SEL_ARG *cur_index_tree= NULL;
   ha_rows cur_quick_prefix_records= 0;
-  uint cur_param_idx;
+  uint cur_param_idx=MAX_KEY;
   key_map cur_used_key_parts;
   uint pk= param->table->s->primary_key;
 
@@ -7328,6 +7324,7 @@ get_best_group_min_max(PARAM *param, SEL
     */
     if (cur_read_cost < best_read_cost - (DBL_EPSILON * cur_read_cost))
     {
+      DBUG_ASSERT(tree != 0 || cur_param_idx == MAX_KEY);
       index_info= cur_index_info;
       index= cur_index;
       best_read_cost= cur_read_cost;

--- 1.186/sql/sql_acl.cc	Wed Dec 28 14:43:44 2005
+++ 1.187/sql/sql_acl.cc	Tue Jan  3 18:04:32 2006
@@ -938,7 +938,7 @@ bool acl_getroot_no_password(Security_co
 
   DBUG_PRINT("enter", ("Host: '%s', Ip: '%s', User: '%s', db: '%s'",
                        (host ? host : "(NULL)"), (ip ? ip : "(NULL)"),
-                       (user ? user : "(NULL)"), (db ? db : "(NULL)")));
+                       user, (db ? db : "(NULL)")));
   sctx->user= user;
   sctx->host= host;
   sctx->ip= ip;
@@ -967,7 +967,7 @@ bool acl_getroot_no_password(Security_co
   for (i=0 ; i < acl_users.elements ; i++)
   {
     acl_user= dynamic_element(&acl_users,i,ACL_USER*);
-    if ((!acl_user->user && (!user || !user[0])) ||
+    if ((!acl_user->user && !user[0]) ||
 	(acl_user->user && strcmp(user, acl_user->user) == 0))
     {
       if (compare_hostname(&acl_user->host, host, ip))
@@ -4954,8 +4954,6 @@ static int handle_grant_struct(uint stru
     }
     if (! user)
       user= "";
-    if (! host)
-      host= "";
 #ifdef EXTRA_DEBUG
     DBUG_PRINT("loop",("scan struct: %u  index: %u  user: '%s'  host: '%s'",
                        struct_no, idx, user, host));

--- 1.121/sql/sql_db.cc	Sun Dec 11 15:06:27 2005
+++ 1.122/sql/sql_db.cc	Tue Jan  3 18:04:33 2006
@@ -287,7 +287,7 @@ static bool write_db_opt(THD *thd, const
 }
 
 
-/* 
+/*
   Load database options file
 
   load_db_opt()
@@ -313,68 +313,72 @@ bool load_db_opt(THD *thd, const char *p
 
   bzero((char*) create,sizeof(*create));
   create->default_table_charset= thd->variables.collation_server;
-  
+
   /* Check if options for this database are already in the hash */
   if (!get_dbopt(path, create))
-    DBUG_RETURN(0);	   
-  
+    DBUG_RETURN(0);
+
   /* Otherwise, load options from the .opt file */
-  if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
-  {
-    IO_CACHE cache;
-    init_io_cache(&cache, file, IO_SIZE, READ_CACHE, 0, 0, MYF(0));
+  if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0)
+    goto err1;
+
+  IO_CACHE cache;
+  if (init_io_cache(&cache, file, IO_SIZE, READ_CACHE, 0, 0, MYF(0)))
+    goto err2;
 
-    while ((int) (nbytes= my_b_gets(&cache, (char*) buf, sizeof(buf))) > 0)
+  while ((int) (nbytes= my_b_gets(&cache, (char*) buf, sizeof(buf))) > 0)
+  {
+    char *pos= buf+nbytes-1;
+    /* Remove end space and control characters */
+    while (pos > buf && !my_isgraph(&my_charset_latin1, pos[-1]))
+      pos--;
+    *pos=0;
+    if ((pos= strchr(buf, '=')))
     {
-      char *pos= buf+nbytes-1;
-      /* Remove end space and control characters */
-      while (pos > buf && !my_isgraph(&my_charset_latin1, pos[-1]))
-	pos--;
-      *pos=0;
-      if ((pos= strchr(buf, '=')))
+      if (!strncmp(buf,"default-character-set", (pos-buf)))
+      {
+        /*
+           Try character set name, and if it fails
+           try collation name, probably it's an old
+           4.1.0 db.opt file, which didn't have
+           separate default-character-set and
+           default-collation commands.
+        */
+        if (!(create->default_table_charset=
+        get_charset_by_csname(pos+1, MY_CS_PRIMARY, MYF(0))) &&
+            !(create->default_table_charset=
+              get_charset_by_name(pos+1, MYF(0))))
+        {
+          sql_print_error("Error while loading database options: '%s':",path);
+          sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1);
+          create->default_table_charset= default_charset_info;
+        }
+      }
+      else if (!strncmp(buf,"default-collation", (pos-buf)))
       {
-	if (!strncmp(buf,"default-character-set", (pos-buf)))
-	{
-          /*
-             Try character set name, and if it fails 
-             try collation name, probably it's an old
-             4.1.0 db.opt file, which didn't have
-             separate default-character-set and
-             default-collation commands.
-          */
-	  if (!(create->default_table_charset=
-		get_charset_by_csname(pos+1, MY_CS_PRIMARY, MYF(0))) &&
-              !(create->default_table_charset=
-                get_charset_by_name(pos+1, MYF(0))))
-	  {
-	    sql_print_error("Error while loading database options: '%s':",path);
-	    sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1);
-            create->default_table_charset= default_charset_info;
-	  }
-	}
-	else if (!strncmp(buf,"default-collation", (pos-buf)))
-	{
-	  if (!(create->default_table_charset= get_charset_by_name(pos+1,
-								   MYF(0))))
-	  {
-	    sql_print_error("Error while loading database options: '%s':",path);
-	    sql_print_error(ER(ER_UNKNOWN_COLLATION),pos+1);
-            create->default_table_charset= default_charset_info;
-	  }
-	}
+        if (!(create->default_table_charset= get_charset_by_name(pos+1,
+                                                           MYF(0))))
+        {
+          sql_print_error("Error while loading database options: '%s':",path);
+          sql_print_error(ER(ER_UNKNOWN_COLLATION),pos+1);
+          create->default_table_charset= default_charset_info;
+        }
       }
     }
-    end_io_cache(&cache);
-    my_close(file,MYF(0));
-    /*
-      Put the loaded value into the hash.
-      Note that another thread could've added the same
-      entry to the hash after we called get_dbopt(),
-      but it's not an error, as put_dbopt() takes this
-      possibility into account.
-    */
-    error= put_dbopt(path, create);
   }
+  /*
+    Put the loaded value into the hash.
+    Note that another thread could've added the same
+    entry to the hash after we called get_dbopt(),
+    but it's not an error, as put_dbopt() takes this
+    possibility into account.
+  */
+  error= put_dbopt(path, create);
+
+  end_io_cache(&cache);
+err2:
+  my_close(file,MYF(0));
+err1:
   DBUG_RETURN(error);
 }
 

--- 1.181/sql/sql_insert.cc	Tue Dec 27 10:30:49 2005
+++ 1.182/sql/sql_insert.cc	Tue Jan  3 18:04:33 2006
@@ -669,7 +669,8 @@ static bool check_view_insertability(THD
 
   DBUG_ASSERT(view->table != 0 && view->field_translation != 0);
 
-  bitmap_init(&used_fields, used_fields_buff, used_fields_buff_size * 8, 0);
+  VOID(bitmap_init(&used_fields, used_fields_buff, used_fields_buff_size * 8,
+                   0));
   bitmap_clear_all(&used_fields);
 
   view->contain_auto_increment= 0;

--- 1.519/sql/sql_parse.cc	Tue Dec 27 10:30:49 2005
+++ 1.520/sql/sql_parse.cc	Tue Jan  3 18:04:34 2006
@@ -1593,6 +1593,11 @@ bool dispatch_command(enum enum_server_c
     statistic_increment(thd->status_var.com_other, &LOCK_status);
     thd->enable_slow_log= opt_log_slow_admin_statements;
     db= thd->alloc(db_len + tbl_len + 2);
+    if (!db)
+    {
+      my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+      break;
+    }
     tbl_name= strmake(db, packet + 1, db_len)+1;
     strmake(tbl_name, packet + db_len + 2, tbl_len);
     mysql_table_dump(thd, db, tbl_name, -1);
@@ -1606,14 +1611,14 @@ bool dispatch_command(enum enum_server_c
     statistic_increment(thd->status_var.com_other, &LOCK_status);
     char *user= (char*) packet;
     char *passwd= strend(user)+1;
-    /* 
+    /*
       Old clients send null-terminated string ('\0' for empty string) for
       password.  New clients send the size (1 byte) + string (not null
       terminated, so also '\0' for empty string).
     */
-    char db_buff[NAME_LEN+1];                 // buffer to store db in utf8 
+    char db_buff[NAME_LEN+1];                 // buffer to store db in utf8
     char *db= passwd;
-    uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? 
+    uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
       *passwd++ : strlen(passwd);
     db+= passwd_len + 1;
 #ifndef EMBEDDED_LIBRARY
@@ -6547,6 +6552,7 @@ bool reload_acl_and_cache(THD *thd, ulon
 #ifdef HAVE_REPLICATION
   if (options & REFRESH_MASTER)
   {
+    DBUG_ASSERT(thd);
     tmp_write_to_binlog= 0;
     if (reset_master(thd))
     {

--- 1.303/sql/sql_show.cc	Tue Jan  3 11:25:13 2006
+++ 1.304/sql/sql_show.cc	Tue Jan  3 18:04:34 2006
@@ -663,7 +663,7 @@ append_identifier(THD *thd, String *pack
    it's a keyword
   */
 
-  packet->reserve(length*2 + 2);
+  VOID(packet->reserve(length*2 + 2));
   quote_char= (char) q;
   packet->append(&quote_char, 1, system_charset_info);
 
@@ -950,13 +950,13 @@ store_create_info(THD *thd, TABLE_LIST *
       if (key_part->field)
         append_identifier(thd,packet,key_part->field->field_name,
 			  strlen(key_part->field->field_name));
-      if (!key_part->field ||
+      if (key_part->field &&
           (key_part->length !=
            table->field[key_part->fieldnr-1]->key_length() &&
            !(key_info->flags & HA_FULLTEXT)))
       {
         buff[0] = '(';
-        char* end=int10_to_str((long) key_part->length / 
+        char* end=int10_to_str((long) key_part->length /
 			       key_part->field->charset()->mbmaxlen,
 			       buff + 1,10);
         *end++ = ')';
@@ -1732,7 +1732,8 @@ LEX_STRING *make_lex_string(THD *thd, LE
 {
   MEM_ROOT *mem= thd->mem_root;
   if (allocate_lex_string)
-    lex_str= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING));
+    if (!(lex_str= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING))))
+      return 0;
   lex_str->str= strmake_root(mem, str, length);
   lex_str->length= length;
   return lex_str;
@@ -2946,7 +2947,7 @@ static int get_schema_stat_record(THD *t
       /*
         I.e. we are in SELECT FROM INFORMATION_SCHEMA.STATISTICS
         rather than in SHOW KEYS
-      */ 
+      */
       if (!tables->view)
         push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
                      thd->net.last_errno, thd->net.last_error);
@@ -2959,7 +2960,7 @@ static int get_schema_stat_record(THD *t
   {
     TABLE *show_table= tables->table;
     KEY *key_info=show_table->key_info;
-    show_table->file->info(HA_STATUS_VARIABLE | 
+    show_table->file->info(HA_STATUS_VARIABLE |
                            HA_STATUS_NO_LOCK |
                            HA_STATUS_TIME);
     for (uint i=0 ; i < show_table->s->keys ; i++,key_info++)
@@ -2971,7 +2972,7 @@ static int get_schema_stat_record(THD *t
         restore_record(table, s->default_values);
         table->field[1]->store(base_name, strlen(base_name), cs);
         table->field[2]->store(file_name, strlen(file_name), cs);
-        table->field[3]->store((longlong) ((key_info->flags & 
+        table->field[3]->store((longlong) ((key_info->flags &
                                             HA_NOSAME) ? 0 : 1), TRUE);
         table->field[4]->store(base_name, strlen(base_name), cs);
         table->field[5]->store(key_info->name, strlen(key_info->name), cs);
@@ -2994,12 +2995,12 @@ static int get_schema_stat_record(THD *t
           table->field[9]->store((longlong) records, TRUE);
           table->field[9]->set_notnull();
         }
-        if (!(key_info->flags & HA_FULLTEXT) && 
-            (!key_part->field ||
-             key_part->length != 
+        if (!(key_info->flags & HA_FULLTEXT) &&
+            (key_part->field &&
+             key_part->length !=
              show_table->field[key_part->fieldnr-1]->key_length()))
         {
-          table->field[10]->store((longlong) key_part->length / 
+          table->field[10]->store((longlong) key_part->length /
                                   key_part->field->charset()->mbmaxlen);
           table->field[10]->set_notnull();
         }
Thread
bk commit into 5.0 tree (serg:1.2010)Sergei Golubchik3 Jan