List:Internals« Previous MessageNext Message »
From:monty Date:July 28 2005 1:10pm
Subject:bk commit into 5.0 tree (monty:1.1911)
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.1911 05/07/28 16:10:14 monty@stripped +15 -0
  Cleanups during review of new code
  Ensure mysql_close() is called if mysql_set_character_set() fails

  strings/decimal.c
    1.59 05/07/28 16:08:52 monty@stripped +5 -2
    Indentation fixes

  sql/sql_trigger.cc
    1.23 05/07/28 16:08:52 monty@stripped +1 -2
    strmov(strmov())  -> strxmov()

  sql/sql_show.cc
    1.258 05/07/28 16:08:52 monty@stripped +9 -9
    Simple optimization (removed loop variable)

  sql/sql_base.cc
    1.272 05/07/28 16:08:52 monty@stripped +8 -8
    Added commments
    Moved variable to inner block

  sql/sql_acl.cc
    1.162 05/07/28 16:08:52 monty@stripped +2 -2
    Indentation fixes

  sql/sp.cc
    1.84 05/07/28 16:08:52 monty@stripped +4 -1
    Indentation fixes

  sql/log.cc
    1.166 05/07/28 16:08:52 monty@stripped +1 -1
    strmov(strmov())  -> strxmov()

  sql-common/client.c
    1.77 05/07/28 16:08:52 monty@stripped +10 -2
    Ensure mysql_close() is called if mysql_set_character_set() fails

  mysys/default.c
    1.76 05/07/28 16:08:52 monty@stripped +26 -26
    Simplify code

  mysys/charset.c
    1.142 05/07/28 16:08:52 monty@stripped +2 -1
    Removed not used variable

  mysql-test/t/type_newdecimal.test
    1.25 05/07/28 16:08:52 monty@stripped +4 -0
    Added test of extreme case

  mysql-test/t/select.test
    1.60 05/07/28 16:08:52 monty@stripped +88 -118
    Fix bad merge & align code with 4.1

  mysql-test/r/type_newdecimal.result
    1.25 05/07/28 16:08:52 monty@stripped +7 -0
    Added test of extreme case

  mysql-test/r/select.result
    1.75 05/07/28 16:08:52 monty@stripped +93 -138
    Fix bad merge & align code with 4.1

  libmysql/libmysql.c
    1.229 05/07/28 16:08:52 monty@stripped +1 -6
    Indentation cleanup

# 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.228/libmysql/libmysql.c	2005-07-21 08:29:52 +03:00
+++ 1.229/libmysql/libmysql.c	2005-07-28 16:08:52 +03:00
@@ -1599,13 +1599,8 @@
 			 ulong length)
 {
   if (mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)
-  {
     return escape_quotes_for_mysql(mysql->charset, to, 0, from, length);
-  }
-  else
-  {
-    return escape_string_for_mysql(mysql->charset, to, 0, from, length);
-  }
+  return escape_string_for_mysql(mysql->charset, to, 0, from, length);
 }
 
 

--- 1.141/mysys/charset.c	2005-07-26 15:53:11 +03:00
+++ 1.142/mysys/charset.c	2005-07-28 16:08:52 +03:00
@@ -588,6 +588,7 @@
     ~0          The escaped string did not fit in the to buffer
     >=0         The length of the escaped string
 */
+
 ulong escape_string_for_mysql(CHARSET_INFO *charset_info,
                               char *to, ulong to_length,
                               const char *from, ulong length)
@@ -702,6 +703,7 @@
     ~0          The escaped string did not fit in the to buffer
     >=0         The length of the escaped string
 */
+
 ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info,
                               char *to, ulong to_length,
                               const char *from, ulong length)
@@ -714,7 +716,6 @@
 #endif
   for (end= from + length; from < end; from++)
   {
-    char escape= 0;
 #ifdef USE_MB
     int tmp_length;
     if (use_mb_flag && (tmp_length= my_ismbchar(charset_info, from, end)))

--- 1.75/mysys/default.c	2005-07-18 18:42:13 +03:00
+++ 1.76/mysys/default.c	2005-07-28 16:08:52 +03:00
@@ -917,6 +917,7 @@
 
 static uint my_get_system_windows_directory(char *buffer, uint size)
 {
+  uint count;
   GET_SYSTEM_WINDOWS_DIRECTORY
     func_ptr= (GET_SYSTEM_WINDOWS_DIRECTORY)
               GetProcAddress(GetModuleHandle("kernel32.dll"),
@@ -924,22 +925,19 @@
 
   if (func_ptr)
     return func_ptr(buffer, size);
-  else
-  {
-    /*
-      Windows NT 4.0 Terminal Server Edition:  
-      To retrieve the shared Windows directory, call GetSystemDirectory and
-      trim the "System32" element from the end of the returned path.
-     */
-    UINT count= GetSystemDirectory(buffer, size);
 
-    if (count > 8 && stricmp(buffer+(count-8), "\\System32") == 0)
-    {
-      count-= 8;
-      buffer[count] = '\0';
-    }
-    return count;
+  /*
+    Windows NT 4.0 Terminal Server Edition:  
+    To retrieve the shared Windows directory, call GetSystemDirectory and
+    trim the "System32" element from the end of the returned path.
+  */
+  count= GetSystemDirectory(buffer, size);
+  if (count > 8 && stricmp(buffer+(count-8), "\\System32") == 0)
+  {
+    count-= 8;
+    buffer[count] = '\0';
   }
+  return count;
 }
 #endif
 
@@ -952,7 +950,7 @@
     2. GetWindowsDirectory()
     3. GetSystemWindowsDirectory()
     4. getenv(DEFAULT_HOME_ENV)
-    5. Direcotry above where the executable is located
+    5. Directory above where the executable is located
     6. ""
 
   On Novell NetWare, this is:
@@ -1011,25 +1009,27 @@
       Look for the second-to-last \ in the filename, but hang on
       to a pointer after the last \ in case we're in the root of
       a drive.
-     */
+    */
     for ( ; end > config_dir; end--)
     {
       if (*end == FN_LIBCHAR)
       {
         if (last)
+        {
+          if (end != config_dir)
+          {
+            /* Keep the last '\' as this works both with D:\ and a directory */
+            end[1]= 0;
+          }
+          else
+          {
+            /' No parent directory (strange). Use current dir + '\' '*/
+            last[1]= 0;
+          }
           break;
+        }
         last= end;
       }
-    }
-
-    if (last)
-    {                                                            
-      if (end != config_dir && end[-1] == FN_DEVCHAR) /* Ended up with D:\ */
-        end[1]= 0; /* Keep one \ */
-      else if (end != config_dir)
-        end[0]= 0; 
-      else
-        last[1]= 0;
     }
     *ptr++= (char *)&config_dir;
   }

--- 1.165/sql/log.cc	2005-07-18 18:36:11 +03:00
+++ 1.166/sql/log.cc	2005-07-28 16:08:52 +03:00
@@ -2209,7 +2209,7 @@
      On Windows is necessary a temporary file for to rename
      the current error file.
     */
-    strmov(strmov(err_temp, err_renamed),"-tmp");
+    strxmov(err_temp, err_renamed,"-tmp",NullS);
     (void) my_delete(err_temp, MYF(0)); 
     if (freopen(err_temp,"a+",stdout))
     {

--- 1.161/sql/sql_acl.cc	2005-07-07 02:47:53 +03:00
+++ 1.162/sql/sql_acl.cc	2005-07-28 16:08:52 +03:00
@@ -3547,9 +3547,9 @@
 {
   char helping [NAME_LEN+USERNAME_LENGTH+2];
   uint len;
-  bool error=1;
+  bool error= 1;
 
-  len  = (uint) (strmov(strmov(helping,thd->priv_user)+1,db)-helping)+ 1;
+  len= (uint) (strmov(strmov(helping,thd->priv_user)+1,db)-helping)+ 1;
   rw_rdlock(&LOCK_grant);
 
   for (uint idx=0 ; idx < column_priv_hash.records ; idx++)

--- 1.271/sql/sql_base.cc	2005-07-21 08:38:38 +03:00
+++ 1.272/sql/sql_base.cc	2005-07-28 16:08:52 +03:00
@@ -1043,26 +1043,26 @@
   if (thd->locked_tables || thd->prelocked_mode)
   {						// Using table locks
     TABLE *best_table= 0;
-    int best_distance= INT_MIN, distance;
+    int best_distance= INT_MIN;
     for (table=thd->open_tables; table ; table=table->next)
     {
       if (table->s->key_length == key_length &&
           !memcmp(table->s->table_cache_key, key, key_length) &&
           !my_strcasecmp(system_charset_info, table->alias, alias) &&
-          table->query_id != thd->query_id && /* skip tables already used by this query */
+          table->query_id != thd->query_id && /* skip tables already used */
           !(thd->prelocked_mode && table->query_id))
       {
-        distance= ((int) table->reginfo.lock_type -
-                   (int) table_list->lock_type);
+        int distance= ((int) table->reginfo.lock_type -
+                       (int) table_list->lock_type);
         /*
           Find a table that either has the exact lock type requested,
           or has the best suitable lock. In case there is no locked
           table that has an equal or higher lock than requested,
-          we still maitain the best_table to produce an error message
-          about wrong lock mode on the table. The best_table is changed
+          we us the closest matching lock to be able to produce an error
+          message about wrong lock mode on the table. The best_table is changed
           if bd < 0 <= d or bd < d < 0 or 0 <= d < bd.
 
-          distance <  0 - we have not enough high lock mode
+          distance <  0 - No suitable lock found
           distance >  0 - we have lock mode higher then we require
           distance == 0 - we have lock mode exactly which we need
         */
@@ -1071,7 +1071,7 @@
         {
           best_distance= distance;
           best_table= table;
-          if (best_distance == 0)
+          if (best_distance == 0)               // Found perfect lock
             break;
         }
       }

--- 1.257/sql/sql_show.cc	2005-07-20 02:33:19 +03:00
+++ 1.258/sql/sql_show.cc	2005-07-28 16:08:52 +03:00
@@ -3543,9 +3543,8 @@
   if (table_list->schema_table_reformed) // show command
   {
     SELECT_LEX *sel= lex->current_select;
-    uint i= 0;
     Item *item;
-    Field_translator *transl;
+    Field_translator *transl, *org_transl;
 
     if (table_list->field_translation)
     {
@@ -3566,16 +3565,17 @@
     {
       DBUG_RETURN(1);
     }
-    while ((item= it++))
+    for (org_transl= transl; (item= it++); transl++)
     {
-      char *name= item->name;
-      transl[i].item= item;
-      if (!item->fixed && item->fix_fields(thd, &transl[i].item))
+      transl->item= item;
+      transl->name= item->name;
+      if (!item->fixed && item->fix_fields(thd, &transl->item))
+      {
         DBUG_RETURN(1);
-      transl[i++].name= name;
+      }
     }
-    table_list->field_translation= transl;
-    table_list->field_translation_end= transl + sel->item_list.elements;
+    table_list->field_translation= org_transl;
+    table_list->field_translation_end= transl;
   }
 
   DBUG_RETURN(0);

--- 1.22/sql/sql_trigger.cc	2005-07-19 19:06:43 +03:00
+++ 1.23/sql/sql_trigger.cc	2005-07-28 16:08:52 +03:00
@@ -564,8 +564,7 @@
               alloc_root(&table->mem_root, triggers->sroutines_key.length)))
         DBUG_RETURN(1);
       triggers->sroutines_key.str[0]= TYPE_ENUM_TRIGGER;
-      strmov(strmov(strmov(triggers->sroutines_key.str+1, db), "."),
-             table_name);
+      strxmov(triggers->sroutines_key.str+1, db, ".", table_name, NullS);
 
       /*
         TODO: This could be avoided if there is no triggers

--- 1.24/mysql-test/r/type_newdecimal.result	2005-07-14 16:50:57 +03:00
+++ 1.25/mysql-test/r/type_newdecimal.result	2005-07-28 16:08:52 +03:00
@@ -946,6 +946,13 @@
   `sl` decimal(5,5) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+create table t1 (sl decimal(65, 30));
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `sl` decimal(65,30) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
 create table t1 (
 f1 decimal unsigned not null default 17.49, 
 f2 decimal unsigned not null default 17.68, 

--- 1.24/mysql-test/t/type_newdecimal.test	2005-07-14 16:50:58 +03:00
+++ 1.25/mysql-test/t/type_newdecimal.test	2005-07-28 16:08:52 +03:00
@@ -986,6 +986,10 @@
 create table t1 (sl decimal(5, 5));
 show create table t1;
 drop table t1;
+# Test limits
+create table t1 (sl decimal(65, 30));
+show create table t1;
+drop table t1;
 
 #
 # Bug 11557 (DEFAULT values rounded improperly

--- 1.76/sql-common/client.c	2005-07-21 07:35:56 +03:00
+++ 1.77/sql-common/client.c	2005-07-28 16:08:52 +03:00
@@ -2206,14 +2206,22 @@
   tmp_mysql.rpl_pivot = mysql->rpl_pivot;
   if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
 			  mysql->db, mysql->port, mysql->unix_socket,
-			  mysql->client_flag | CLIENT_REMEMBER_OPTIONS) ||
-      mysql_set_character_set(&tmp_mysql, mysql->charset->csname))
+			  mysql->client_flag | CLIENT_REMEMBER_OPTIONS))
   {
     mysql->net.last_errno= tmp_mysql.net.last_errno;
     strmov(mysql->net.last_error, tmp_mysql.net.last_error);
     strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate);
     DBUG_RETURN(1);
   }
+  if (mysql_set_character_set(&tmp_mysql, mysql->charset->csname))
+  {
+    mysql_close(&tmp_mysql);
+    mysql->net.last_errno= tmp_mysql.net.last_errno;
+    strmov(mysql->net.last_error, tmp_mysql.net.last_error);
+    strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate);
+    DBUG_RETURN(1);
+  }
+
   tmp_mysql.reconnect= 1;
   tmp_mysql.free_me= mysql->free_me;
 

--- 1.74/mysql-test/r/select.result	2005-07-20 02:32:34 +03:00
+++ 1.75/mysql-test/r/select.result	2005-07-28 16:08:52 +03:00
@@ -2492,6 +2492,99 @@
 id	name	gid	uid	ident	level
 1	fs	NULL	NULL	0	READ
 drop table t1,t2,t3;
+CREATE TABLE t1 (
+acct_id int(11) NOT NULL default '0',
+profile_id smallint(6) default NULL,
+UNIQUE KEY t1$acct_id (acct_id),
+KEY t1$profile_id (profile_id)
+);
+INSERT INTO t1 VALUES (132,17),(133,18);
+CREATE TABLE t2 (
+profile_id smallint(6) default NULL,
+queue_id int(11) default NULL,
+seq int(11) default NULL,
+KEY t2$queue_id (queue_id)
+);
+INSERT INTO t2 VALUES (17,31,4),(17,30,3),(17,36,2),(17,37,1);
+CREATE TABLE t3 (
+id int(11) NOT NULL default '0',
+qtype int(11) default NULL,
+seq int(11) default NULL,
+warn_lvl int(11) default NULL,
+crit_lvl int(11) default NULL,
+rr1 tinyint(4) NOT NULL default '0',
+rr2 int(11) default NULL,
+default_queue tinyint(4) NOT NULL default '0',
+KEY t3$qtype (qtype),
+KEY t3$id (id)
+);
+INSERT INTO t3 VALUES (30,1,29,NULL,NULL,0,NULL,0),(31,1,28,NULL,NULL,0,NULL,0),
+(36,1,34,NULL,NULL,0,NULL,0),(37,1,35,NULL,NULL,0,121,0);
+SELECT COUNT(*) FROM t1 a STRAIGHT_JOIN t2 pq STRAIGHT_JOIN t3 q 
+WHERE 
+(pq.profile_id = a.profile_id) AND (a.acct_id = 132) AND 
+(pq.queue_id = q.id) AND (q.rr1 <> 1);
+COUNT(*)
+4
+drop table t1,t2,t3;
+create table t1 (f1 int);
+insert into t1 values (1),(NULL);
+create table t2 (f2 int, f3 int, f4 int);
+create index idx1 on t2 (f4);
+insert into t2 values (1,2,3),(2,4,6);
+select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
+from  t2 C where A.f4 = C.f4) or A.f3 IS NULL;
+f2
+1
+NULL
+drop table t1,t2;
+create table t2 (a tinyint unsigned);
+create index t2i on t2(a);
+insert into t2 values (0), (254), (255);
+explain select * from t2 where a > -1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	index	t2i	t2i	2	NULL	3	Using where; Using index
+select * from t2 where a > -1;
+a
+0
+254
+255
+drop table t2;
+CREATE TABLE t1 (a int, b int, c int);
+INSERT INTO t1
+SELECT 50, 3, 3 FROM DUAL
+WHERE NOT EXISTS
+(SELECT * FROM t1 WHERE a = 50 AND b = 3);
+SELECT * FROM t1;
+a	b	c
+50	3	3
+INSERT INTO t1
+SELECT 50, 3, 3 FROM DUAL
+WHERE NOT EXISTS
+(SELECT * FROM t1 WHERE a = 50 AND b = 3);
+select found_rows();
+found_rows()
+0
+SELECT * FROM t1;
+a	b	c
+50	3	3
+select count(*) from t1;
+count(*)
+1
+select found_rows();
+found_rows()
+1
+select count(*) from t1 limit 2,3;
+count(*)
+select found_rows();
+found_rows()
+0
+select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3;
+count(*)
+select found_rows();
+found_rows()
+1
+DROP TABLE t1;
 CREATE TABLE t1 ( city char(30) );
 INSERT INTO t1 VALUES ('London');
 INSERT INTO t1 VALUES ('Paris');
@@ -2579,25 +2672,6 @@
 WART	0100	1
 WART	0200	1
 WART	0300	3
-select found_rows();
-found_rows()
-3
-select count(*) from t1;
-count(*)
-15
-select found_rows();
-found_rows()
-1
-select count(*) from t1 limit 2,3;
-count(*)
-select found_rows();
-found_rows()
-0
-select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3;
-count(*)
-select found_rows();
-found_rows()
-1
 DROP TABLE t1;
 CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
 CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
@@ -2612,51 +2686,6 @@
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	
 1	SIMPLE	t2	ref	a	a	23	test.t1.a	2	
 DROP TABLE t1, t2;
-CREATE TABLE t1 ( city char(30) );
-INSERT INTO t1 VALUES ('London');
-INSERT INTO t1 VALUES ('Paris');
-SELECT * FROM t1 WHERE city='London';
-city
-London
-SELECT * FROM t1 WHERE city='london';
-city
-London
-EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
-SELECT * FROM t1 WHERE city='London' AND city='london';
-city
-London
-EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
-SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
-city
-London
-DROP TABLE t1;
-create table t1 (a int(11) unsigned, b int(11) unsigned);
-insert into t1 values (1,0), (1,1), (1,2);
-select a-b  from t1 order by 1;
-a-b
-0
-1
-18446744073709551615
-select a-b , (a-b < 0)  from t1 order by 1;
-a-b	(a-b < 0)
-0	0
-1	0
-18446744073709551615	0
-select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
-d	(a-b >= 0)	b
-1	1	0
-0	1	1
-18446744073709551615	1	2
-select cast((a - b) as unsigned) from t1 order by 1;
-cast((a - b) as unsigned)
-0
-1
-18446744073709551615
-drop table t1;
 create table t1 (a int, b int);
 create table t2 like t1;
 select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1;
@@ -2730,77 +2759,3 @@
 select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
 x'10' + 0	X'10' + 0	b'10' + 0	B'10' + 0
 16	16	2	2
-CREATE TABLE t1 (
-acct_id int(11) NOT NULL default '0',
-profile_id smallint(6) default NULL,
-UNIQUE KEY t1$acct_id (acct_id),
-KEY t1$profile_id (profile_id)
-);
-INSERT INTO t1 VALUES (132,17),(133,18);
-CREATE TABLE t2 (
-profile_id smallint(6) default NULL,
-queue_id int(11) default NULL,
-seq int(11) default NULL,
-KEY t2$queue_id (queue_id)
-);
-INSERT INTO t2 VALUES (17,31,4),(17,30,3),(17,36,2),(17,37,1);
-CREATE TABLE t3 (
-id int(11) NOT NULL default '0',
-qtype int(11) default NULL,
-seq int(11) default NULL,
-warn_lvl int(11) default NULL,
-crit_lvl int(11) default NULL,
-rr1 tinyint(4) NOT NULL default '0',
-rr2 int(11) default NULL,
-default_queue tinyint(4) NOT NULL default '0',
-KEY t3$qtype (qtype),
-KEY t3$id (id)
-);
-INSERT INTO t3 VALUES (30,1,29,NULL,NULL,0,NULL,0),(31,1,28,NULL,NULL,0,NULL,0),
-(36,1,34,NULL,NULL,0,NULL,0),(37,1,35,NULL,NULL,0,121,0);
-SELECT COUNT(*) FROM t1 a STRAIGHT_JOIN t2 pq STRAIGHT_JOIN t3 q 
-WHERE 
-(pq.profile_id = a.profile_id) AND (a.acct_id = 132) AND 
-(pq.queue_id = q.id) AND (q.rr1 <> 1);
-COUNT(*)
-4
-drop table t1,t2,t3;
-create table t1 (f1 int);
-insert into t1 values (1),(NULL);
-create table t2 (f2 int, f3 int, f4 int);
-create index idx1 on t2 (f4);
-insert into t2 values (1,2,3),(2,4,6);
-select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
-from  t2 C where A.f4 = C.f4) or A.f3 IS NULL;
-f2
-1
-NULL
-drop table t1,t2;
-create table t2 (a tinyint unsigned);
-create index t2i on t2(a);
-insert into t2 values (0), (254), (255);
-explain select * from t2 where a > -1;
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	index	t2i	t2i	2	NULL	3	Using where; Using index
-select * from t2 where a > -1;
-a
-0
-254
-255
-drop table t2;
-CREATE TABLE t1 (a int, b int, c int);
-INSERT INTO t1
-SELECT 50, 3, 3 FROM DUAL
-WHERE NOT EXISTS
-(SELECT * FROM t1 WHERE a = 50 AND b = 3);
-SELECT * FROM t1;
-a	b	c
-50	3	3
-INSERT INTO t1
-SELECT 50, 3, 3 FROM DUAL
-WHERE NOT EXISTS
-(SELECT * FROM t1 WHERE a = 50 AND b = 3);
-SELECT * FROM t1;
-a	b	c
-50	3	3
-DROP TABLE t1;

--- 1.59/mysql-test/t/select.test	2005-07-20 02:32:34 +03:00
+++ 1.60/mysql-test/t/select.test	2005-07-28 16:08:52 +03:00
@@ -2080,6 +2080,94 @@
 
 drop table t1,t2,t3;
 
+# Test for BUG#11700
+CREATE TABLE t1 (
+  acct_id int(11) NOT NULL default '0',
+  profile_id smallint(6) default NULL,
+  UNIQUE KEY t1$acct_id (acct_id),
+  KEY t1$profile_id (profile_id)
+);
+INSERT INTO t1 VALUES (132,17),(133,18);
+
+CREATE TABLE t2 (
+  profile_id smallint(6) default NULL,
+  queue_id int(11) default NULL,
+  seq int(11) default NULL,
+  KEY t2$queue_id (queue_id)
+);
+INSERT INTO t2 VALUES (17,31,4),(17,30,3),(17,36,2),(17,37,1);
+
+CREATE TABLE t3 (
+  id int(11) NOT NULL default '0',
+  qtype int(11) default NULL,
+  seq int(11) default NULL,
+  warn_lvl int(11) default NULL,
+  crit_lvl int(11) default NULL,
+  rr1 tinyint(4) NOT NULL default '0',
+  rr2 int(11) default NULL,
+  default_queue tinyint(4) NOT NULL default '0',
+  KEY t3$qtype (qtype),
+  KEY t3$id (id)
+);
+
+INSERT INTO t3 VALUES (30,1,29,NULL,NULL,0,NULL,0),(31,1,28,NULL,NULL,0,NULL,0),
+  (36,1,34,NULL,NULL,0,NULL,0),(37,1,35,NULL,NULL,0,121,0);
+
+SELECT COUNT(*) FROM t1 a STRAIGHT_JOIN t2 pq STRAIGHT_JOIN t3 q 
+WHERE 
+  (pq.profile_id = a.profile_id) AND (a.acct_id = 132) AND 
+  (pq.queue_id = q.id) AND (q.rr1 <> 1);
+
+drop table t1,t2,t3;
+
+#
+# Bug #11482 Wrongly applied optimization was erroneously rejecting valid
+#            rows 
+create table t1 (f1 int);
+insert into t1 values (1),(NULL);
+create table t2 (f2 int, f3 int, f4 int);
+create index idx1 on t2 (f4);
+insert into t2 values (1,2,3),(2,4,6);
+select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
+from  t2 C where A.f4 = C.f4) or A.f3 IS NULL; 
+drop table t1,t2;
+
+#
+# Bug #11521 Negative integer keys incorrectly substituted for 0 during
+#            range analysis.
+
+create table t2 (a tinyint unsigned);
+create index t2i on t2(a);
+insert into t2 values (0), (254), (255);
+explain select * from t2 where a > -1;
+select * from t2 where a > -1;
+drop table t2;
+
+#
+# Bug #11745: SELECT ... FROM DUAL with WHERE condition
+#
+
+CREATE TABLE t1 (a int, b int, c int);
+INSERT INTO t1
+  SELECT 50, 3, 3 FROM DUAL
+    WHERE NOT EXISTS
+      (SELECT * FROM t1 WHERE a = 50 AND b = 3);
+SELECT * FROM t1;
+INSERT INTO t1
+  SELECT 50, 3, 3 FROM DUAL
+    WHERE NOT EXISTS
+      (SELECT * FROM t1 WHERE a = 50 AND b = 3);
+select found_rows();
+SELECT * FROM t1;
+select count(*) from t1;
+select found_rows();
+select count(*) from t1 limit 2,3;
+select found_rows();
+select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3;
+select found_rows();
+
+DROP TABLE t1;
+
 #
 # Test case for bug 7098: substitution of a constant for a string field 
 #
@@ -2154,15 +2242,6 @@
         (F2I4 = 2 AND K2C4 = 'WART' OR (F2I4 = 2 OR K4N4 = '0200'));
 SELECT K2C4, K4N4, F2I4 FROM t1
   WHERE  K2C4 = 'WART' AND (K2C4 = 'WART' OR K4N4 = '0200');
-
-select found_rows();
-select count(*) from t1;
-select found_rows();
-select count(*) from t1 limit 2,3;
-select found_rows();
-select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3;
-select found_rows();
-
 DROP TABLE t1;
 
 #
@@ -2180,36 +2259,6 @@
 
 DROP TABLE t1, t2;
 
-
-#
-# Test case for bug 7098: substitution of a constant for a string field 
-#
-
-CREATE TABLE t1 ( city char(30) );
-INSERT INTO t1 VALUES ('London');
-INSERT INTO t1 VALUES ('Paris');
-
-SELECT * FROM t1 WHERE city='London';
-SELECT * FROM t1 WHERE city='london';
-EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
-SELECT * FROM t1 WHERE city='London' AND city='london';
-EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
-SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
-
-DROP TABLE t1;
-
-#
-# Bug#7425 inconsistent sort order on unsigned columns result of substraction
-#
-
-create table t1 (a int(11) unsigned, b int(11) unsigned);
-insert into t1 values (1,0), (1,1), (1,2);
-select a-b  from t1 order by 1;
-select a-b , (a-b < 0)  from t1 order by 1;
-select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
-select cast((a - b) as unsigned) from t1 order by 1;
-drop table t1;
-
 #
 # Bug#8670
 #
@@ -2297,82 +2346,3 @@
 #
 
 select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
-# Test for BUG#11700
-CREATE TABLE t1 (
-  acct_id int(11) NOT NULL default '0',
-  profile_id smallint(6) default NULL,
-  UNIQUE KEY t1$acct_id (acct_id),
-  KEY t1$profile_id (profile_id)
-);
-INSERT INTO t1 VALUES (132,17),(133,18);
-
-CREATE TABLE t2 (
-  profile_id smallint(6) default NULL,
-  queue_id int(11) default NULL,
-  seq int(11) default NULL,
-  KEY t2$queue_id (queue_id)
-);
-INSERT INTO t2 VALUES (17,31,4),(17,30,3),(17,36,2),(17,37,1);
-
-CREATE TABLE t3 (
-  id int(11) NOT NULL default '0',
-  qtype int(11) default NULL,
-  seq int(11) default NULL,
-  warn_lvl int(11) default NULL,
-  crit_lvl int(11) default NULL,
-  rr1 tinyint(4) NOT NULL default '0',
-  rr2 int(11) default NULL,
-  default_queue tinyint(4) NOT NULL default '0',
-  KEY t3$qtype (qtype),
-  KEY t3$id (id)
-);
-
-INSERT INTO t3 VALUES (30,1,29,NULL,NULL,0,NULL,0),(31,1,28,NULL,NULL,0,NULL,0),
-  (36,1,34,NULL,NULL,0,NULL,0),(37,1,35,NULL,NULL,0,121,0);
-
-SELECT COUNT(*) FROM t1 a STRAIGHT_JOIN t2 pq STRAIGHT_JOIN t3 q 
-WHERE 
-  (pq.profile_id = a.profile_id) AND (a.acct_id = 132) AND 
-  (pq.queue_id = q.id) AND (q.rr1 <> 1);
-
-drop table t1,t2,t3;
-
-#
-# Bug #11482 Wrongly applied optimization was erroneously rejecting valid
-#            rows 
-create table t1 (f1 int);
-insert into t1 values (1),(NULL);
-create table t2 (f2 int, f3 int, f4 int);
-create index idx1 on t2 (f4);
-insert into t2 values (1,2,3),(2,4,6);
-select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
-from  t2 C where A.f4 = C.f4) or A.f3 IS NULL; 
-drop table t1,t2;
-#
-# Bug #11521 Negative integer keys incorrectly substituted for 0 during
-#            range analysis.
-
-create table t2 (a tinyint unsigned);
-create index t2i on t2(a);
-insert into t2 values (0), (254), (255);
-explain select * from t2 where a > -1;
-select * from t2 where a > -1;
-drop table t2;
-
-#
-# Bug #11745: SELECT ... FROM DUAL with WHERE condition
-#
-
-CREATE TABLE t1 (a int, b int, c int);
-INSERT INTO t1
-  SELECT 50, 3, 3 FROM DUAL
-    WHERE NOT EXISTS
-      (SELECT * FROM t1 WHERE a = 50 AND b = 3);
-SELECT * FROM t1;
-INSERT INTO t1
-  SELECT 50, 3, 3 FROM DUAL
-    WHERE NOT EXISTS
-      (SELECT * FROM t1 WHERE a = 50 AND b = 3);
-SELECT * FROM t1;
-
-DROP TABLE t1;

--- 1.83/sql/sp.cc	2005-07-19 19:06:43 +03:00
+++ 1.84/sql/sp.cc	2005-07-28 16:08:52 +03:00
@@ -1443,7 +1443,9 @@
     Sroutine_hash_entry **last_cached_routine_ptr=
                             (Sroutine_hash_entry **)lex->sroutines_list.next;
     for (int i= 0; i < (int)TRG_EVENT_MAX; i++)
+    {
       for (int j= 0; j < (int)TRG_ACTION_MAX; j++)
+      {
         if (triggers->bodies[i][j])
         {
           (void)triggers->bodies[i][j]->add_used_tables_to_table_list(thd,
@@ -1451,7 +1453,8 @@
           sp_update_stmt_used_routines(thd, lex,
                                        &triggers->bodies[i][j]->m_sroutines);
         }
-
+      }
+    }
     (void)sp_cache_routines_and_add_tables_aux(thd, lex,
                                                *last_cached_routine_ptr);
   }

--- 1.58/strings/decimal.c	2005-07-12 12:17:53 +03:00
+++ 1.59/strings/decimal.c	2005-07-28 16:08:52 +03:00
@@ -745,14 +745,17 @@
     new_point= ROUND_UP(new_point) - 1;
 
   if (new_point > end)
+  {
     do
     {
       dec->buf[new_point]=0;
-    }while (--new_point > end);
+    } while (--new_point > end);
+  }
   else
+  {
     for (; new_point < beg; new_point++)
       dec->buf[new_point]= 0;
-
+  }
   dec->intg= digits_int;
   dec->frac= digits_frac;
   return err;
Thread
bk commit into 5.0 tree (monty:1.1911)monty28 Jul