[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-internals
Subject:    bk commit into 5.0 tree (msvensson:1.2032)
From:       msvensson () mysql ! com
Date:       2005-09-30 14:51:41
Message-ID: 20050930145141.CA0F525DFA2 () blaudden ! homeip ! net
[Download RAW message or body]

Below is the list of changes that have just been committed into a local
5.0 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.2032 05/09/30 16:51:35 msvensson@neptunus.(none) +6 -0
  Merge bk-internal.mysql.com:/home/bk/mysql-5.0
  into  neptunus.(none):/home/msvensson/mysql/bug13231/my50-bug13231

  sql/sql_db.cc
    1.119 05/09/30 16:51:29 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_cache.cc
    1.86 05/09/30 16:51:29 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/mysql_priv.h
    1.356 05/09/30 16:51:29 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/query_cache.test
    1.50 05/09/30 16:51:29 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/mysqltest.result
    1.14 05/09/30 16:51:29 msvensson@neptunus.(none) +0 -0
    Auto merged

  client/mysqltest.c
    1.167 05/09/30 16:51:29 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/bug13231/my50-bug13231/RESYNC

--- 1.355/sql/mysql_priv.h	2005-09-23 15:47:01 +02:00
+++ 1.356/sql/mysql_priv.h	2005-09-30 16:51:29 +02:00
@@ -538,6 +538,7 @@
   unsigned int client_long_flag:1;
   unsigned int client_protocol_41:1;
   unsigned int more_results_exists:1;
+  unsigned int pkt_nr;
   uint character_set_client_num;
   uint character_set_results_num;
   uint collation_connection_num;

--- 1.85/sql/sql_cache.cc	2005-09-26 16:56:00 +02:00
+++ 1.86/sql/sql_cache.cc	2005-09-30 16:51:29 +02:00
@@ -801,6 +801,7 @@
                                    CLIENT_PROTOCOL_41);
     flags.more_results_exists= test(thd->server_status &
                                     SERVER_MORE_RESULTS_EXISTS);
+    flags.pkt_nr= net->pkt_nr;
     flags.character_set_client_num=
       thd->variables.character_set_client->number;
     flags.character_set_results_num=
@@ -814,12 +815,13 @@
     flags.sql_mode= thd->variables.sql_mode;
     flags.max_sort_length= thd->variables.max_sort_length;
     flags.group_concat_max_len= thd->variables.group_concat_max_len;
-    DBUG_PRINT("qcache", ("long %d, 4.1: %d, more results %d, \
+    DBUG_PRINT("qcache", ("long %d, 4.1: %d, more results %d, pkt_nr: %d, \
 CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
 sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
                           (int)flags.client_long_flag,
                           (int)flags.client_protocol_41,
                           (int)flags.more_results_exists,
+                          flags.pkt_nr,
                           flags.character_set_client_num,
                           flags.character_set_results_num,
                           flags.collation_connection_num,
@@ -1019,6 +1021,7 @@
                                  CLIENT_PROTOCOL_41);
   flags.more_results_exists= test(thd->server_status &
                                   SERVER_MORE_RESULTS_EXISTS);
+  flags.pkt_nr= thd->net.pkt_nr;
   flags.character_set_client_num= thd->variables.character_set_client->number;
   flags.character_set_results_num=
     (thd->variables.character_set_results ?
@@ -1030,12 +1033,13 @@
   flags.sql_mode= thd->variables.sql_mode;
   flags.max_sort_length= thd->variables.max_sort_length;
   flags.group_concat_max_len= thd->variables.group_concat_max_len;
-  DBUG_PRINT("qcache", ("long %d, 4.1: %d, more results %d, \
+  DBUG_PRINT("qcache", ("long %d, 4.1: %d, more results %d, pkt_nr: %d, \
 CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
 sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
                           (int)flags.client_long_flag,
                           (int)flags.client_protocol_41,
                           (int)flags.more_results_exists,
+                          flags.pkt_nr,
                           flags.character_set_client_num,
                           flags.character_set_results_num,
                           flags.collation_connection_num,

--- 1.118/sql/sql_db.cc	2005-09-20 20:20:33 +02:00
+++ 1.119/sql/sql_db.cc	2005-09-30 16:51:29 +02:00
@@ -440,7 +440,8 @@
     push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
                         ER_DB_CREATE_EXISTS, ER(ER_DB_CREATE_EXISTS), db);
     error= 0;
-    send_ok(thd);
+    if (!silent)
+      send_ok(thd);
     goto exit;
   }
   else

--- 1.13/mysql-test/r/mysqltest.result	2005-09-21 15:28:23 +02:00
+++ 1.14/mysql-test/r/mysqltest.result	2005-09-30 16:51:29 +02:00
@@ -178,6 +178,7 @@
 echo message echo message
 
 mysqltest: At line 1: Empty variable
+mysqltest: At line 1: command "false" failed
 mysqltest: At line 1: Missing argument in exec
 MySQL
 "MySQL"
@@ -299,6 +300,7 @@
 mysqltest: At line 1: End of line junk detected: "1000"
 mysqltest: At line 1: Missing arguments to system, nothing to do!
 mysqltest: At line 1: Missing arguments to system, nothing to do!
+mysqltest: At line 1: system command 'false' failed
 test
 test2
 test3
@@ -342,6 +344,10 @@
 mysqltest: At line 1: Invalid integer argument "10!"
 mysqltest: At line 1: End of line junk detected: "!"
 mysqltest: At line 1: Invalid integer argument "a"
+Output from mysqltest-x.inc
+Output from mysqltest-x.inc
+Output from mysqltest-x.inc
+mysqltest: Could not open ./non_existing_file.inc: errno = 2
 failing_statement;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds \
to your MySQL server version for the right syntax to use near 'failing_statement' at \
line 1  failing_statement;

--- 1.49/mysql-test/t/query_cache.test	2005-09-15 21:17:37 +02:00
+++ 1.50/mysql-test/t/query_cache.test	2005-09-30 16:51:29 +02:00
@@ -776,6 +776,7 @@
 
 #
 # query in QC from normal execution and SP (BUG#6897)
+# improved to also test BUG#3583 and BUG#12990
 #
 flush query cache;
 reset query cache;
@@ -785,6 +786,22 @@
 create procedure f1 () begin
 select sql_cache * from t1;
 select sql_cache * from t1;
+select sql_cache * from t1;
+end;//
+create procedure f2 () begin
+select sql_cache * from t1 where s1=1;
+select sql_cache * from t1;
+end;//
+create procedure f3 () begin
+select sql_cache * from t1;
+select sql_cache * from t1 where s1=1;
+end;//
+create procedure f4 () begin
+select sql_cache * from t1;
+select sql_cache * from t1 where s1=1;
+select sql_cache * from t1;
+select sql_cache * from t1 where s1=1;
+select sql_cache * from t1 where s1=1;
 end;//
 delimiter ;//
 call f1();
@@ -811,7 +828,32 @@
 show status like "Qcache_queries_in_cache";
 show status like "Qcache_inserts";
 show status like "Qcache_hits";
+flush query cache;
+reset query cache;
+flush status;
+select sql_cache * from t1;
+select sql_cache * from t1 where s1=1;
+call f1();
+call f2();
+call f3();
+call f4();
+call f4();
+call f3();
+call f2();
+select sql_cache * from t1 where s1=1;
+insert into t1 values (2);
+call f1();
+select sql_cache * from t1 where s1=1;
+select sql_cache * from t1;
+call f1();
+call f3();
+call f3();
+call f1();
+
 drop procedure f1;
+drop procedure f2;
+drop procedure f3;
+drop procedure f4;
 drop table t1;
 set GLOBAL query_cache_size=0;
 

--- 1.166/client/mysqltest.c	2005-09-30 11:36:12 +02:00
+++ 1.167/client/mysqltest.c	2005-09-30 16:51:29 +02:00
@@ -3062,12 +3062,6 @@
       goto end;
     }
 
-    if (handle_no_error(q))
-    {
-      error= 1;
-      goto end;
-    }
-
     if (!disable_result_log)
     {
       ulong affected_rows;    /* Ok to be undef if 'disable_info' is set */
@@ -3112,12 +3106,9 @@
 	MYSQL_RES *warn_res=0;
 	uint count= mysql_warning_count(mysql);
 	if (!mysql_real_query(mysql, "SHOW WARNINGS", 13))
-	{
 	  warn_res= mysql_store_result(mysql);
-	}
 	if (!warn_res)
-	  verbose_msg("Warning count is %u but didn't get any warnings",
-		      count);
+	  die("Warning count is %u but didn't get any warnings", count);
 	else
 	{
 	  dynstr_append_mem(ds, "Warnings:\n", 10);
@@ -3148,15 +3139,28 @@
     }
     else if (q->record_file[0])
     {
-      error = check_result(ds, q->record_file, q->require_file);
+      error= check_result(ds, q->record_file, q->require_file);
     }
     if (res)
       mysql_free_result(res);
     last_result= 0;
     counter++;
   } while (!(err= mysql_next_result(mysql)));
-  if (err >= 1)
-    mysql_error(mysql);
+  if (err > 0)
+  {
+      /* We got an error from mysql_next_result, maybe expected */
+    if (handle_error(query, q, mysql_errno(mysql), mysql_error(mysql),
+                     mysql_sqlstate(mysql), ds))
+      error= 1;
+    goto end;
+  }
+
+  // If we come here the query is both executed and read successfully
+  if (handle_no_error(q))
+  {
+    error= 1;
+    goto end;
+  }
 
 end:
   free_replace();
@@ -3209,8 +3213,7 @@
     abort_not_supported_test();
  
   if (q->abort_on_error)
-    die("query '%s' failed: %d: %s", query,
-        err_errno, err_error);
+    die("query '%s' failed: %d: %s", query, err_errno, err_error);
 
   for (i= 0 ; (uint) i < q->expected_errors ; i++)
   {
@@ -3249,13 +3252,11 @@
   if (i)
   {
     if (q->expected_errno[0].type == ERR_ERRNO)
-      verbose_msg("query '%s' failed with wrong errno %d instead of %d...",
-                  q->query, err_errno,
-                  q->expected_errno[0].code.errnum);
+      die("query '%s' failed with wrong errno %d instead of %d...",
+          q->query, err_errno, q->expected_errno[0].code.errnum);
     else
-      verbose_msg("query '%s' failed with wrong sqlstate %s instead of %s...",
-                  q->query, err_sqlstate,
-                  q->expected_errno[0].code.sqlstate);
+      die("query '%s' failed with wrong sqlstate %s instead of %s...",
+          q->query, err_sqlstate, q->expected_errno[0].code.sqlstate);
     DBUG_RETURN(1);
   }
 
@@ -3289,16 +3290,16 @@
       q->expected_errno[0].code.errnum != 0)
   {
     /* Error code we wanted was != 0, i.e. not an expected success */
-    verbose_msg("query '%s' succeeded - should have failed with errno %d...",
-                q->query, q->expected_errno[0].code.errnum);
+    die("query '%s' succeeded - should have failed with errno %d...",
+        q->query, q->expected_errno[0].code.errnum);
     DBUG_RETURN(1);
   }
   else if (q->expected_errno[0].type == ERR_SQLSTATE &&
            strcmp(q->expected_errno[0].code.sqlstate,"00000") != 0)
   {
     /* SQLSTATE we wanted was != "00000", i.e. not an expected success */
-    verbose_msg("query '%s' succeeded - should have failed with sqlstate %s...",
-                q->query, q->expected_errno[0].code.sqlstate);
+    die("query '%s' succeeded - should have failed with sqlstate %s...",
+        q->query, q->expected_errno[0].code.sqlstate);
     DBUG_RETURN(1);
   }
 
@@ -3318,7 +3319,7 @@
 {
   int error= 0;             /* Function return code if "goto end;" */
   int err;                  /* Temporary storage of return code from calls */
-  int query_len, got_error_on_execute;
+  int query_len;
   ulonglong num_rows;
   char *query;
   MYSQL_RES *res= NULL;     /* Note that here 'res' is meta data result set */
@@ -3334,7 +3335,7 @@
   */
   if (!(stmt= mysql_stmt_init(mysql)))
     die("unable init stmt structure");
-  
+
   if (q->type != Q_EVAL)
   {
     query= q->query;
@@ -3375,30 +3376,21 @@
 
   if (err != 0)
   {
-    if (q->abort_on_error)
-    {
-      die("query '%s' failed: %d: %s", query,
-          mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
-    }
-    else
-    {
-      /*
-        Preparing is part of normal execution and some errors may be expected
-      */
-      error= handle_error(query, q, mysql_stmt_errno(stmt),
-                          mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt),
-                          ds);
-      goto end;
-    }
+    /*
+      Preparing is part of normal execution and some errors may be expected
+    */
+    if (handle_error(query, q,  mysql_stmt_errno(stmt),
+                     mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds))
+      error= 1;
+    goto end;
   }
 
   /* We may have got warnings already, collect them if any */
-  /* FIXME we only want this if the statement succeeds I think */ 
   if (!disable_ps_warnings)
     run_query_stmt_handle_warnings(mysql, ds);
 
   /*
-    No need to call mysql_stmt_bind_param() because we have no 
+    No need to call mysql_stmt_bind_param() because we have no
     parameter markers.
 
     To optimize performance we use a global 'stmt' that is initiated
@@ -3407,24 +3399,13 @@
     prepared statement.
   */
 
-  if ((got_error_on_execute= mysql_stmt_execute(stmt)) != 0) /* 0 == Success */
+  if (mysql_stmt_execute(stmt) != 0) /* 0 == Success */
   {
-    if (q->abort_on_error)
-    {
-      /* We got an error, unexpected */
-      die("unable to execute statement '%s': "
-          "%s (mysql_stmt_errno=%d returned=%d)",
-          query, mysql_stmt_error(stmt),
-          mysql_stmt_errno(stmt), got_error_on_execute);
-    }
-    else
-    {
-      /* We got an error, maybe expected */
-      error= handle_error(query, q, mysql_stmt_errno(stmt),
-                          mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt),
-                          ds);
-      goto end;
-    }
+    /* We got an error, maybe expected */
+    if (handle_error(query, q, mysql_stmt_errno(stmt),
+                     mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds))
+      error= 1;
+    goto end;
   }
 
   /*
@@ -3434,11 +3415,10 @@
   */
   {
     my_bool one= 1;
-    if (mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH,
-                            (void*) &one) != 0)
+    if ((err= mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH,
+                                  (void*) &one)) != 0)
       die("unable to set stmt attribute "
-          "'STMT_ATTR_UPDATE_MAX_LENGTH': %s (returned=%d)",
-          query, err);
+          "'STMT_ATTR_UPDATE_MAX_LENGTH' err: %d", err);
   }
 
   /*
@@ -3447,22 +3427,11 @@
   */
   if ((err= mysql_stmt_store_result(stmt)) != 0)
   {
-    if (q->abort_on_error)
-    {
-      /* We got an error, unexpected */
-      die("unable to execute statement '%s': "
-          "%s (mysql_stmt_errno=%d returned=%d)",
-          query, mysql_stmt_error(stmt),
-          mysql_stmt_errno(stmt), got_error_on_execute);
-    }
-    else
-    {
-      /* We got an error, maybe expected */
-      error= handle_error(query, q, mysql_stmt_errno(stmt),
-                          mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt),
-                          ds);
-      goto end;
-    }
+    /* We got an error, maybe expected */
+    if(handle_error(query, q, mysql_stmt_errno(stmt),
+                    mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds))
+      error = 1;
+    goto end;
   }
 
   /* If we got here the statement was both executed and read succeesfully */
@@ -3486,8 +3455,6 @@
     MYSQL_FIELD *field= mysql_fetch_fields(res);
     uint num_fields= mysql_num_fields(res);
 
-    /* FIXME check error from the above? */
-
     if (display_metadata)
       run_query_display_metadata(field, num_fields, ds);
 
@@ -3640,9 +3607,6 @@
     mysql_free_result(res);     /* Free normal result set with meta data */
   last_result= 0;               /* FIXME have no idea what this is about... */
 
-  if (err >= 1)
-    mysql_error(mysql);         /* FIXME strange, has no effect... */
-
 end:
   free_replace();
   last_result=0;
@@ -3733,8 +3697,8 @@
     {
       MYSQL_RES *warn_res= mysql_store_result(mysql);
       if (!warn_res)
-        verbose_msg("Warning count is %u but didn't get any warnings",
-                    count);
+        die("Warning count is %u but didn't get any warnings",
+            count);
       else
       {
         dynstr_append_mem(ds, "Warnings:\n", 10);

-- 
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:    http://lists.mysql.com/internals?unsub=mysql-internals@progressive-comp.com



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic