List:Internals« Previous MessageNext Message »
From:Sinisa Date:July 22 2001 10:25am
Subject:bk commit into 4.0 tree
View as plain text  
Below is the list of changes that have just been committed into a
4.0 repository of Sinisa. When Sinisa does a push, they will be propogated 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet@stripped, 2001-07-22 13:25:56+03:00, Sinisa@stripped
  UNIONs : further work

  sql/sql_lex.h
    1.44 01/07/22 13:25:55 Sinisa@stripped +1 -1
    Addition for UNION ALL

  sql/sql_parse.cc
    1.150 01/07/22 13:25:55 Sinisa@stripped +27 -23
    Init for UNION ALL

  sql/sql_unions.cc
    1.6 01/07/22 13:25:55 Sinisa@stripped +7 -5
    Bug fixes in UNION's

  sql/sql_yacc.yy
    1.101 01/07/22 13:25:55 Sinisa@stripped +7 -3
    UNION ALL

# 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:	Sinisa
# Host:	sinisa.nasamreza.org
# Root:	/mnt/hdc/Sinisa/mysql-4.0

--- 1.43/sql/sql_lex.h	Sun Jul  8 06:22:02 2001
+++ 1.44/sql/sql_lex.h	Sun Jul 22 13:25:55 2001
@@ -180,7 +180,7 @@
   enum enum_ha_read_modes ha_read_mode;
   enum ha_rkey_function ha_rkey_mode;
   enum enum_enable_or_disable alter_keys_onoff;
-  uint grant,grant_tot_col,which_columns;
+  uint grant,grant_tot_col,which_columns, union_option;
   thr_lock_type lock_option;
   bool	drop_primary,drop_if_exists,local_file;
   bool  in_comment,ignore_space,verbose,simple_alter, option_type;

--- 1.149/sql/sql_parse.cc	Thu Jul 19 13:34:44 2001
+++ 1.150/sql/sql_parse.cc	Sun Jul 22 13:25:55 2001
@@ -1761,7 +1761,9 @@
 				for (TABLE_LIST *cursor=(TABLE_LIST *)sl->table_list.first;cursor;cursor=cursor->next)
 					cursor->table= ((TABLE_LIST*) cursor->table)->table;
 			}
+			ha_rows save_it=thd->offset_limit; thd->offset_limit=0;
       res=mysql_union(thd,lex, select_lex->select_number+1);
+			thd->offset_limit=save_it;
 		}
     close_thread_tables(thd);
     break;
@@ -2440,9 +2442,9 @@
   SELECT_LEX *select_lex = lex->select;
   select_lex->where=select_lex->having=0;
   select_lex->select_limit=current_thd->default_select_limit;
-  select_lex->offset_limit=0L;
+  select_lex->offset_limit=0;
   select_lex->options=0; select_lex->linkage=UNSPECIFIED_TYPE;
-  select_lex->select_number = 0;  lex->exchange = 0;
+  select_lex->select_number = 0;  lex->exchange = 0; lex->union_option=0;
   lex->proc_list.first=0;
   select_lex->order_list.elements=select_lex->group_list.elements=0;
   select_lex->order_list.first=0;
@@ -2915,29 +2917,31 @@
     if (aux)
     {
       if (check_table_access(thd, lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL , aux))
-	return -1;
+				return -1;
       for (;aux;aux=aux->next)
       {
-	if (!aux->db)
-	  aux->db=(char *)current_db;
-	for (cursor=(TABLE_LIST *)tables->first;cursor;cursor=cursor->next)
-	  if (!strcmp(cursor->db,aux->db) && (!strcmp(cursor->real_name,aux->real_name)))
-	    break;
-	if (!cursor ||  !tables->first)
-	{
-	  aux->lock_type= lex->lock_option;
-	  if (!tables->next)
-	    tables->next= (byte**) &tables->first;
-		if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
-			return 1;
-		ptr->db= aux->db; ptr->real_name=aux->real_name;
-		ptr->name=aux->name;  ptr->lock_type=aux->lock_type;
-		ptr->updating=aux->updating;
-    ptr->use_index=aux->use_index;
-    ptr->ignore_index=aux->use_index;
-    aux->table=(TABLE *)ptr;
-	  link_in_list(tables,(byte*)ptr,(byte**) &ptr->next);
-	}
+				if (!aux->db)
+					aux->db=(char *)current_db;
+				for (cursor=(TABLE_LIST *)tables->first;cursor;cursor=cursor->next)
+					if (!strcmp(cursor->db,aux->db) && (!strcmp(cursor->real_name,aux->real_name)))
+						break;
+				if (!cursor ||  !tables->first)
+				{
+					aux->lock_type= lex->lock_option;
+					if (!tables->next)
+						tables->next= (byte**) &tables->first;
+					if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
+						return 1;
+					ptr->db= aux->db; ptr->real_name=aux->real_name;
+					ptr->name=aux->name;  ptr->lock_type=aux->lock_type;
+					ptr->updating=aux->updating;
+					ptr->use_index=aux->use_index;
+					ptr->ignore_index=aux->use_index;
+					aux->table=(TABLE *)ptr;
+					link_in_list(tables,(byte*)ptr,(byte**) &ptr->next);
+				}
+				else
+					aux->table=(TABLE *)cursor;
       }
     }
   }

--- 1.100/sql/sql_yacc.yy	Sun Jul  8 06:22:02 2001
+++ 1.101/sql/sql_yacc.yy	Sun Jul 22 13:25:55 2001
@@ -551,7 +551,7 @@
 	table_to_table_list table_to_table opt_table_list opt_as
 	handler_rkey_function handler_rkey_mode handler_read_or_scan
 	single_multi table_wild_list table_wild_one opt_wild union union_list
-	precision
+	precision union_option
 END_OF_INPUT
 
 %type <NONE>
@@ -3404,11 +3404,15 @@
   | union_list
 
 union_list:
-  UNION_SYM  
+  UNION_SYM    union_option
   {
     LEX *lex=Lex;
     if (lex->exchange) YYABORT; /* Only the last SELECT can have  INTO...... */
     lex->sql_command=SQLCOM_UNION_SELECT;
     mysql_new_select(lex); lex->select->linkage=UNION_TYPE;
   } 
-  select
+	select
+
+union_option:
+  /* empty */ {}
+  | ALL {Lex->union_option=1;}

--- 1.5/sql/sql_unions.cc	Thu Jul 19 13:31:53 2001
+++ 1.6/sql/sql_unions.cc	Sun Jul 22 13:25:55 2001
@@ -72,10 +72,10 @@
 					return res;
 				}
 				table=create_result->table;
-				List_iterator<Item> it(*(create_result->fields));
+/*				List_iterator<Item> it(*(create_result->fields));
 				Item *item;
 				while ((item= it++))
-					fields.push_back(item);
+				fields.push_back(item);*/
 				if (!(resulting = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
 					return 1;
 				resulting->db=tables->db ? tables->db : thd->db;
@@ -88,8 +88,8 @@
     }
     else // Then we do INSERT from SELECT
     {
-      select_result *result;
-      if ((result=new select_insert(table, &fields, DUP_IGNORE, true)))
+			select_insert *result;
+      if ((result=new select_insert(table, create_result->fields, DUP_IGNORE, true)))
       {
 				res=mysql_select(thd,tables,sl->item_list,
 												 sl->where,
@@ -104,7 +104,7 @@
 				if (res) 
 				{
 					delete create_result;
-					return 1;
+					return res;
 				}
       }
       else
@@ -142,6 +142,8 @@
       result->abort();
 		delete result;
   }
+	else
+		res=-1;
   delete create_result;
   return res;
 }
Thread
bk commit into 4.0 treeSinisa22 Jul