List:Commits« Previous MessageNext Message »
From:msvensson Date:March 7 2006 9:07pm
Subject:bk commit into 5.1 tree (msvensson:1.2167)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson 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.2167 06/03/07 22:06:56 msvensson@neptunus.(none) +8 -0
  Merge bk-internal:/home/bk/mysql-5.1-new
  into  neptunus.(none):/home/msvensson/mysql/mysql-5.1

  sql/sql_yacc.yy
    1.474 06/03/07 22:06:48 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/item.cc
    1.173 06/03/07 22:06:47 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/sp.test
    1.185 06/03/07 22:06:47 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/mysqldump.test
    1.92 06/03/07 22:06:47 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/union.result
    1.83 06/03/07 22:06:47 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/sp.result
    1.198 06/03/07 22:06:47 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/mysql-test-run.pl
    1.82 06/03/07 22:06:47 msvensson@neptunus.(none) +0 -0
    Auto merged

  client/mysqltest.c
    1.195 06/03/07 22:06:46 msvensson@neptunus.(none) +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:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/mysql-5.1/RESYNC

--- 1.473/sql/sql_yacc.yy	2006-03-06 21:36:51 +01:00
+++ 1.474/sql/sql_yacc.yy	2006-03-07 22:06:48 +01:00
@@ -42,6 +42,12 @@
 #include <myisam.h>
 #include <myisammrg.h>
 
+typedef struct p_elem_val
+{ 
+  longlong value;
+  bool null_value;
+} part_elem_value;
+
 int yylex(void *yylval, void *yythd);
 
 const LEX_STRING null_lex_str={0,0};
@@ -105,6 +111,7 @@
   sp_name *spname;
   struct st_lex *lex;
   sp_head *sphead;
+  struct p_elem_val *p_elem_value;
 }
 
 %{
@@ -752,7 +759,7 @@
 %type <ulonglong_number>
 	ulonglong_num size_number
 
-%type <longlong_number>
+%type <p_elem_value>
         part_bit_expr
 
 %type <lock_type>
@@ -3781,7 +3788,7 @@
 part_range_func:
         '(' part_bit_expr ')' 
         {
-          Lex->part_info->curr_part_elem->range_value= $2;
+          Lex->part_info->curr_part_elem->range_value= $2->value;
         }
         ;
 
@@ -3793,12 +3800,12 @@
 part_list_item:
         part_bit_expr
         {
-          longlong *value_ptr;
-          if (!(value_ptr= (longlong*)sql_alloc(sizeof(longlong))) ||
-              ((*value_ptr= $1, FALSE) ||
-     Lex->part_info->curr_part_elem->list_val_list.push_back(value_ptr)))
+          part_elem_value *value_ptr= $1;
+          if (!value_ptr->null_value &&
+             Lex->part_info->curr_part_elem->
+              list_val_list.push_back((longlong*) &value_ptr->value))
           {
-            mem_alloc_error(sizeof(longlong));
+            mem_alloc_error(sizeof(part_elem_value));
             YYABORT;
           }
         }
@@ -3818,6 +3825,15 @@
 
           context->table_list= 0;
           thd->where= "partition function";
+
+          part_elem_value *value_ptr= 
+            (part_elem_value*)sql_alloc(sizeof(part_elem_value));
+          if (!value_ptr)
+          {
+            mem_alloc_error(sizeof(part_elem_value));
+            YYABORT;
+          }
+
           if (part_expr->fix_fields(YYTHD, (Item**)0) ||
               ((context->table_list= save_list), FALSE) ||
               (!part_expr->const_item()) ||
@@ -3827,13 +3843,23 @@
             YYABORT;
           }
           thd->where= save_where;
-          if (part_expr->result_type() != INT_RESULT)
+          value_ptr->value= part_expr->val_int();
+          if ((value_ptr->null_value= part_expr->null_value))
+          {
+            if (Lex->part_info->curr_part_elem->has_null_value)
+            {
+              my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0));
+              YYABORT;
+            }
+            Lex->part_info->curr_part_elem->has_null_value= TRUE;
+          }
+          else if (part_expr->result_type() != INT_RESULT &&
+                   !part_expr->null_value)
           {
             yyerror(ER(ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR));
             YYABORT;
           }
-          item_value= part_expr->val_int();
-          $$= item_value; 
+          $$= value_ptr; 
         }
         ;
 
@@ -7150,9 +7176,8 @@
         {
 	  LEX *lex= Lex;
 	  lex->derived_tables|= DERIVED_SUBQUERY;
-	  if (((int)lex->sql_command >= (int)SQLCOM_HA_OPEN &&
-	       lex->sql_command <= (int)SQLCOM_HA_READ) ||
-	       lex->sql_command == (int)SQLCOM_KILL)
+          if (lex->sql_command == (int)SQLCOM_HA_READ ||
+              lex->sql_command == (int)SQLCOM_KILL)
 	  {
 	    yyerror(ER(ER_SYNTAX_ERROR));
 	    YYABORT;
@@ -8647,18 +8672,18 @@
 /* kill threads */
 
 kill:
-	KILL_SYM kill_option expr
+	KILL_SYM { Lex->sql_command= SQLCOM_KILL; } kill_option expr
 	{
 	  LEX *lex=Lex;
 	  lex->value_list.empty();
-	  lex->value_list.push_front($3);
-          lex->sql_command= SQLCOM_KILL;
+	  lex->value_list.push_front($4);
 	};
 
 kill_option:
 	/* empty */	 { Lex->type= 0; }
 	| CONNECTION_SYM { Lex->type= 0; }
-	| QUERY_SYM      { Lex->type= ONLY_KILL_QUERY; };
+	| QUERY_SYM      { Lex->type= ONLY_KILL_QUERY; }
+        ;
 
 /* change database */
 
@@ -8671,7 +8696,7 @@
 
 /* import, export of files */
 
-load:   LOAD DATA_SYM 
+load:   LOAD DATA_SYM
         {
           LEX *lex=Lex;
 	  if (lex->sphead)
@@ -10739,9 +10764,8 @@
 	'(' SELECT_SYM
 	{
 	  LEX *lex=Lex;
-	  if (((int)lex->sql_command >= (int)SQLCOM_HA_OPEN &&
-	       lex->sql_command <= (int)SQLCOM_HA_READ) ||
-	       lex->sql_command == (int)SQLCOM_KILL)
+          if (lex->sql_command == (int)SQLCOM_HA_READ ||
+              lex->sql_command == (int)SQLCOM_KILL)
 	  {
             yyerror(ER(ER_SYNTAX_ERROR));
 	    YYABORT;

--- 1.194/client/mysqltest.c	2006-03-06 21:36:49 +01:00
+++ 1.195/client/mysqltest.c	2006-03-07 22:06:46 +01:00
@@ -492,6 +492,7 @@
 static void str_to_file(const char *fname, char *str, int size);
 
 #ifdef __WIN__
+static void free_tmp_sh_file();
 static void free_win_path_patterns();
 #endif
 
@@ -641,6 +642,7 @@
   mysql_server_end();
   free_re();
 #ifdef __WIN__
+  free_tmp_sh_file();
   free_win_path_patterns();
 #endif
   DBUG_VOID_RETURN;
@@ -1106,6 +1108,35 @@
   return open_file(name);
 }
 
+#ifdef __WIN__
+/* Variables used for temuprary sh files used for emulating Unix on Windows */
+char tmp_sh_name[64], tmp_sh_cmd[70];
+
+static void init_tmp_sh_file()
+{
+  /* Format a name for the tmp sh file that is unique for this process */
+  my_snprintf(tmp_sh_name, sizeof(tmp_sh_name), "tmp_%d.sh", getpid());
+  /* Format the command to execute in order to run the script */
+  my_snprintf(tmp_sh_cmd, sizeof(tmp_sh_cmd), "sh %s", tmp_sh_name);
+}
+
+static void free_tmp_sh_file()
+{
+  my_delete(tmp_sh_name, MYF(0));
+}
+#endif
+
+FILE* my_popen(DYNAMIC_STRING* ds_cmd, const char* mode)
+{
+#ifdef __WIN__
+  /* Dump the command into a sh script file and execute with popen */
+  str_to_file(tmp_sh_name, ds_cmd->str, ds_cmd->length);
+  return popen(tmp_sh_cmd, mode);
+#else
+  return popen(ds_cmd->str, mode);
+#endif
+}
+
 
 /*
   Execute given command.
@@ -1152,7 +1183,7 @@
   DBUG_PRINT("info", ("Executing '%s' as '%s'",
                       query->first_argument, cmd));
 
-  if (!(res_file= popen(cmd, "r")) && query->abort_on_error)
+  if (!(res_file= my_popen(&ds_cmd, "r")) && query->abort_on_error)
     die("popen(\"%s\", \"r\") failed", query->first_argument);
 
   while (fgets(buf, sizeof(buf), res_file))
@@ -1375,7 +1406,6 @@
   SYNOPSIS
     do_modify_var()
     query	called command
-    name        human readable name of operator
     operator    operation to perform on the var
 
   DESCRIPTION
@@ -1384,15 +1414,16 @@
 
 */
 
-int do_modify_var(struct st_query *query, const char *name,
+int do_modify_var(struct st_query *query,
                   enum enum_operator operator)
 {
   const char *p= query->first_argument;
   VAR* v;
   if (!*p)
-    die("Missing arguments to %s", name);
+    die("Missing argument to %.*s", query->first_word_len, query->query);
   if (*p != '$')
-    die("First argument to %s must be a variable (start with $)", name);
+    die("The argument to %.*s must be a variable (start with $)",
+        query->first_word_len, query->query);
   v= var_get(p, &p, 1, 0);
   switch (operator) {
   case DO_DEC:
@@ -1402,7 +1433,7 @@
     v->int_val++;
     break;
   default:
-    die("Invalid operator to do_operator");
+    die("Invalid operator to do_modify_var");
     break;
   }
   v->int_dirty= 1;
@@ -1425,15 +1456,9 @@
 int my_system(DYNAMIC_STRING* ds_cmd)
 {
 #ifdef __WIN__
-  /* Dump the command into a sh script file and execute with "sh" */
-  int err;
-  char tmp_sh_name[64], tmp_sh_cmd[70];
-  my_snprintf(tmp_sh_name, sizeof(tmp_sh_name), "tmp_%d.sh", getpid());
-  my_snprintf(tmp_sh_cmd, sizeof(tmp_sh_cmd), "sh %s", tmp_sh_name);
+  /* Dump the command into a sh script file and execute with system */
   str_to_file(tmp_sh_name, ds_cmd->str, ds_cmd->length);
-  err= system(tmp_sh_cmd);
-  my_delete(tmp_sh_name, MYF(0));
-  return err;
+  return system(tmp_sh_cmd);
 #else
   return system(ds_cmd->str);
 #endif
@@ -1820,7 +1845,6 @@
   char *p= query->first_argument;
   char *sleep_start, *sleep_end= query->end;
   double sleep_val;
-  const char *cmd = (real_sleep ? "real_sleep" : "sleep");
 
   while (my_isspace(charset_info, *p))
     p++;
@@ -5123,6 +5147,7 @@
   init_var_hash(&cur_con->mysql);
 
 #ifdef __WIN__
+  init_tmp_sh_file();
   init_win_path_patterns();
 #endif
 
@@ -5181,8 +5206,8 @@
       case Q_SERVER_START: do_server_start(q); break;
       case Q_SERVER_STOP: do_server_stop(q); break;
 #endif
-      case Q_INC: do_modify_var(q, "inc", DO_INC); break;
-      case Q_DEC: do_modify_var(q, "dec", DO_DEC); break;
+      case Q_INC: do_modify_var(q, DO_INC); break;
+      case Q_DEC: do_modify_var(q, DO_DEC); break;
       case Q_ECHO: do_echo(q); query_executed= 1; break;
       case Q_SYSTEM: do_system(q); break;
       case Q_DELIMITER:
Thread
bk commit into 5.1 tree (msvensson:1.2167)msvensson7 Mar