List:Commits« Previous MessageNext Message »
From:tim Date:September 1 2006 6:54am
Subject:bk commit into 5.0 tree (tsmith:1.2269)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tsmith. When tsmith 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-09-01 08:53:56+02:00, tsmith@stripped +12 -0
  Merge maint2.mysql.com:/data/localhome/tsmith/bk/41
  into  maint2.mysql.com:/data/localhome/tsmith/bk/50
  MERGE: 1.1616.2144.189

  client/mysql.cc@stripped, 2006-09-01 08:47:09+02:00, tsmith@stripped +1 -2
    Manual merge.
    MERGE: 1.121.1.99

  mysql-test/r/ctype_recoding.result@stripped, 2006-09-01 08:53:40+02:00, tsmith@stripped +1 -0
    Manual merge

  mysql-test/r/ctype_recoding.result@stripped, 2006-09-01 08:42:19+02:00, tsmith@stripped +0 -1
    Auto merged
    MERGE: 1.20.1.6

  mysql-test/r/ctype_utf8.result@stripped, 2006-09-01 08:42:19+02:00, tsmith@stripped +0 -0
    Auto merged
    MERGE: 1.45.1.26

  mysql-test/t/ctype_recoding.test@stripped, 2006-09-01 08:49:52+02:00, tsmith@stripped +3 -3
    Manual merge.
    MERGE: 1.21.1.1

  mysql-test/t/ctype_utf8.test@stripped, 2006-09-01 08:42:19+02:00, tsmith@stripped +0 -0
    Auto merged
    MERGE: 1.57.1.16

  sql/net_serv.cc@stripped, 2006-09-01 08:42:19+02:00, tsmith@stripped +0 -0
    Auto merged
    MERGE: 1.63.1.13

  sql/sql_lex.cc@stripped, 2006-09-01 08:42:19+02:00, tsmith@stripped +0 -0
    Auto merged
    MERGE: 1.97.21.4

  sql/sql_lex.h@stripped, 2006-09-01 08:50:42+02:00, tsmith@stripped +0 -0
    SCCS merged
    MERGE: 1.102.41.3

  sql/sql_select.cc@stripped, 2006-09-01 08:42:20+02:00, tsmith@stripped +0 -0
    Auto merged
    MERGE: 1.216.125.4

  sql/sql_table.cc@stripped, 2006-09-01 08:53:28+02:00, tsmith@stripped +10 -10
    Manual merge.
    MERGE: 1.157.2.151

  sql/sql_yacc.yy@stripped, 2006-09-01 08:42:20+02:00, tsmith@stripped +0 -0
    Auto merged
    MERGE: 1.203.1.196

  vio/viosocket.c@stripped, 2006-09-01 08:42:20+02:00, tsmith@stripped +0 -0
    Auto merged
    MERGE: 1.25.1.11

# 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:	tsmith
# Host:	maint2.mysql.com
# Root:	/data/localhome/tsmith/bk/50/RESYNC

--- 1.216/client/mysql.cc	2006-09-01 08:53:26 +02:00
+++ 1.217/client/mysql.cc	2006-09-01 08:53:26 +02:00
@@ -2354,9 +2354,14 @@ print_table_data(MYSQL_RES *result)
     (void) tee_fputs("|", PAGER);
     for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
     {
-      tee_fprintf(PAGER, " %-*s |",(int) min(field->max_length,
+      uint name_length= (uint) strlen(field->name);
+      uint numcells= charset_info->cset->numcells(charset_info,
+                                                  field->name,
+                                                  field->name + name_length);
+      uint display_length= field->max_length + name_length - numcells;
+      tee_fprintf(PAGER, " %-*s |",(int) min(display_length,
                                             MAX_COLUMN_LENGTH),
-		  field->name);
+                  field->name);
       num_flag[off]= IS_NUM(field->type);
       not_null_flag[off]= IS_NOT_NULL(field->flags);
     }

--- 1.90/sql/net_serv.cc	2006-09-01 08:53:26 +02:00
+++ 1.91/sql/net_serv.cc	2006-09-01 08:53:26 +02:00
@@ -860,7 +860,7 @@ my_real_read(NET *net, ulong *complen)
 #endif /* EXTRA_DEBUG */
 	  }
 #if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
-	  if (vio_should_retry(net->vio))
+	  if (vio_errno(net->vio) == SOCKET_EINTR)
 	  {
 	    DBUG_PRINT("warning",("Interrupted read. Retrying..."));
 	    continue;

--- 1.197/sql/sql_lex.cc	2006-09-01 08:53:26 +02:00
+++ 1.198/sql/sql_lex.cc	2006-09-01 08:53:26 +02:00
@@ -654,8 +654,9 @@ int MYSQLlex(void *arg, void *yythd)
       */
 
       if ((yylval->lex_str.str[0]=='_') && 
-          (lex->charset=get_charset_by_csname(yylval->lex_str.str+1,
-					      MY_CS_PRIMARY,MYF(0))))
+          (lex->underscore_charset=
+             get_charset_by_csname(yylval->lex_str.str + 1,
+                                   MY_CS_PRIMARY,MYF(0))))
         return(UNDERSCORE_CHARSET);
       return(result_state);			// IDENT or IDENT_QUOTED
 

--- 1.225/sql/sql_lex.h	2006-09-01 08:53:26 +02:00
+++ 1.226/sql/sql_lex.h	2006-09-01 08:53:26 +02:00
@@ -834,7 +834,7 @@ typedef struct st_lex : public Query_tab
   XID *xid;
   gptr yacc_yyss,yacc_yyvs;
   THD *thd;
-  CHARSET_INFO *charset;
+  CHARSET_INFO *charset, *underscore_charset;
   /* store original leaf_tables for INSERT SELECT and PS/SP */
   TABLE_LIST *leaf_tables_insert;
   /* Position (first character index) of SELECT of CREATE VIEW statement */

--- 1.448/sql/sql_select.cc	2006-09-01 08:53:26 +02:00
+++ 1.449/sql/sql_select.cc	2006-09-01 08:53:26 +02:00
@@ -7210,6 +7210,8 @@ change_cond_ref_to_const(THD *thd, I_Lis
        left_item->collation.collation == value->collation.collation))
   {
     Item *tmp=value->new_item();
+    tmp->collation.set(right_item->collation);
+    
     if (tmp)
     {
       thd->change_item_tree(args + 1, tmp);
@@ -7232,6 +7234,8 @@ change_cond_ref_to_const(THD *thd, I_Lis
             right_item->collation.collation == value->collation.collation))
   {
     Item *tmp=value->new_item();
+    tmp->collation.set(left_item->collation);
+    
     if (tmp)
     {
       thd->change_item_tree(args, tmp);

--- 1.320/sql/sql_table.cc	2006-09-01 08:53:26 +02:00
+++ 1.321/sql/sql_table.cc	2006-09-01 08:53:26 +02:00
@@ -715,6 +715,40 @@ static int mysql_prepare_table(THD *thd,
       DBUG_RETURN(-1);
     }
 
+    /*
+      Convert the default value from client character
+      set into the column character set if necessary.
+    */
+    if (sql_field->def && 
+        save_cs != sql_field->def->collation.collation &&
+        (sql_field->sql_type == FIELD_TYPE_VAR_STRING ||
+         sql_field->sql_type == FIELD_TYPE_STRING ||
+         sql_field->sql_type == FIELD_TYPE_SET ||
+         sql_field->sql_type == FIELD_TYPE_ENUM))
+    {
+      Query_arena backup_arena;
+      bool need_to_change_arena= !thd->stmt_arena->is_conventional();
+      if (need_to_change_arena)
+      {
+        /* Asser that we don't do that at every PS execute */
+        DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
+                    thd->stmt_arena->is_first_sp_execute());
+        thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
+      }
+
+      sql_field->def= sql_field->def->safe_charset_converter(save_cs);
+
+      if (need_to_change_arena)
+        thd->restore_active_arena(thd->stmt_arena, &backup_arena);
+
+      if (sql_field->def == NULL)
+      {
+        /* Could not convert */
+        my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
+        DBUG_RETURN(-1);
+      }
+    }
+
     if (sql_field->sql_type == FIELD_TYPE_SET ||
         sql_field->sql_type == FIELD_TYPE_ENUM)
     {
@@ -774,35 +808,6 @@ static int mysql_prepare_table(THD *thd,
           }
         }
         sql_field->interval_list.empty(); // Don't need interval_list anymore
-      }
-
-      /*
-        Convert the default value from client character
-        set into the column character set if necessary.
-      */
-      if (sql_field->def && cs != sql_field->def->collation.collation)
-      {
-        Query_arena backup_arena;
-        bool need_to_change_arena= !thd->stmt_arena->is_conventional();
-        if (need_to_change_arena)
-        {
-          /* Asser that we don't do that at every PS execute */
-          DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
-                      thd->stmt_arena->is_first_sp_execute());
-          thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
-        }
-
-        sql_field->def= sql_field->def->safe_charset_converter(cs);
-
-        if (need_to_change_arena)
-          thd->restore_active_arena(thd->stmt_arena, &backup_arena);
-
-        if (sql_field->def == NULL)
-        {
-          /* Could not convert */
-          my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
-          DBUG_RETURN(-1);
-        }
       }
 
       if (sql_field->sql_type == FIELD_TYPE_SET)

--- 1.482/sql/sql_yacc.yy	2006-09-01 08:53:26 +02:00
+++ 1.483/sql/sql_yacc.yy	2006-09-01 08:53:26 +02:00
@@ -7069,7 +7069,7 @@ text_literal:
 	| NCHAR_STRING
 	{ $$=  new Item_string($1.str,$1.length,national_charset_info); }
 	| UNDERSCORE_CHARSET TEXT_STRING
-	  { $$ = new Item_string($2.str,$2.length,Lex->charset); }
+	  { $$ = new Item_string($2.str,$2.length,Lex->underscore_charset); }
 	| text_literal TEXT_STRING_literal
 	  { ((Item_string*) $1)->append($2.str,$2.length); }
 	;
@@ -7147,7 +7147,7 @@ literal:
 	      (String*) 0;
 	    $$= new Item_string(str ? str->ptr() : "",
 				str ? str->length() : 0,
-				Lex->charset);
+				Lex->underscore_charset);
 	  }
 	| UNDERSCORE_CHARSET BIN_NUM
           {

--- 1.30/mysql-test/r/ctype_recoding.result	2006-09-01 08:53:26 +02:00
+++ 1.32/mysql-test/r/ctype_recoding.result	2006-09-01 08:53:26 +02:00
 drop table t1;
+set names koi8r;
+create table t1(a char character set cp1251 default _koi8r 0xFF);
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a char character set latin1 default _cp1251 0xFF);
+ERROR 42000: Invalid default value for 'a'
+End of 4.1 tests

--- 1.94/mysql-test/r/ctype_utf8.result	2006-09-01 08:53:26 +02:00
+++ 1.95/mysql-test/r/ctype_utf8.result	2006-09-01 08:53:26 +02:00
@@ -924,6 +924,37 @@ NULL
 select ifnull(NULL, _utf8'string');
 ifnull(NULL, _utf8'string')
 string
+set names utf8;
+create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
+insert into t1 values ('I'),('K'),('Y');
+select * from t1 where s1 < 'K' and s1 = 'Y';
+s1
+I
+Y
+select * from t1 where 'K' > s1 and s1 = 'Y';
+s1
+I
+Y
+drop table t1;
+create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
+insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
+select * from t1 where s1 > 'd' and s1 = 'CH';
+s1
+ch
+CH
+Ch
+select * from t1 where 'd' < s1 and s1 = 'CH';
+s1
+ch
+CH
+Ch
+select * from t1 where s1 = 'cH' and s1 <> 'ch';
+s1
+cH
+select * from t1 where 'cH' = s1 and s1 <> 'ch';
+s1
+cH
+drop table t1;
 create table t1 (a varchar(255)) default character set utf8;
 insert into t1 values (1.0);
 drop table t1;

--- 1.22/mysql-test/t/ctype_recoding.test	2006-09-01 08:53:26 +02:00
+++ 1.23/mysql-test/t/ctype_recoding.test	2006-09-01 08:53:26 +02:00
 drop table t1;
-# End of 4.1 tests
+ 
+#
+# Bug 20695: problem with field default value's character set
+#
+
+set names koi8r;
+create table t1(a char character set cp1251 default _koi8r 0xFF);
+show create table t1;
+drop table t1;
+--error 1067
+create table t1(a char character set latin1 default _cp1251 0xFF);
+
+--echo End of 4.1 tests

--- 1.87/mysql-test/t/ctype_utf8.test	2006-09-01 08:53:26 +02:00
+++ 1.88/mysql-test/t/ctype_utf8.test	2006-09-01 08:53:26 +02:00
@@ -728,6 +728,24 @@ select repeat(_utf8'+',3) as h union sel
 select ifnull(NULL, _utf8'string');
 
 #
+# Bug#9509 Optimizer: wrong result after AND with comparisons
+#
+set names utf8;
+create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
+insert into t1 values ('I'),('K'),('Y');
+select * from t1 where s1 < 'K' and s1 = 'Y';
+select * from t1 where 'K' > s1 and s1 = 'Y';
+drop table t1;
+
+create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
+insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
+select * from t1 where s1 > 'd' and s1 = 'CH';
+select * from t1 where 'd' < s1 and s1 = 'CH';
+select * from t1 where s1 = 'cH' and s1 <> 'ch';
+select * from t1 where 'cH' = s1 and s1 <> 'ch';
+drop table t1;
+
+#
 # Bug#10714: Inserting double value into utf8 column crashes server
 #
 create table t1 (a varchar(255)) default character set utf8;

--- 1.37/vio/viosocket.c	2006-09-01 08:53:26 +02:00
+++ 1.38/vio/viosocket.c	2006-09-01 08:53:26 +02:00
@@ -379,16 +379,30 @@ my_bool vio_poll_read(Vio *vio,uint time
 }
 
 
-void vio_timeout(Vio *vio __attribute__((unused)),
-		 uint which __attribute__((unused)),
-                 uint timeout __attribute__((unused)))
+void vio_timeout(Vio *vio, uint which, uint timeout)
 {
+/* TODO: some action should be taken if socket timeouts are not supported. */
+#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
+
 #ifdef __WIN__
-  ulong wait_timeout= (ulong) timeout * 1000;
-  (void) setsockopt(vio->sd, SOL_SOCKET, 
-	which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout,
-        sizeof(wait_timeout));
-#endif /* __WIN__ */
+
+  /* Windows expects time in milliseconds as int. */
+  int wait_timeout= (int) timeout * 1000;
+
+#else  /* ! __WIN__ */
+
+  /* POSIX specifies time as struct timeval. */
+  struct timeval wait_timeout;
+  wait_timeout.tv_sec= timeout;
+  wait_timeout.tv_usec= 0;
+
+#endif /* ! __WIN__ */
+
+  /* TODO: return value should be checked. */
+  (void) setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO,
+                    (char*) &wait_timeout, sizeof(wait_timeout));
+
+#endif /* defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) */
 }
 
 
Thread
bk commit into 5.0 tree (tsmith:1.2269)tim1 Sep