MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:April 15 2008 6:51pm
Subject:bk commit into 5.0 tree (cmiller:1.2580) BUG#34898
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cmiller.  When cmiller 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, 2008-04-15 14:51:32-04:00, cmiller@stripped +5 -0
  Bug#34898: mysql_info() reports 0 warnings while mysql_warning_count() \
  	reports 1
  
  The parameter that filled the value for the count of warnings for
  info output used a different variable than the counting function did.
  
  Now, use thd->total_warning_count everywhere we used thd->cuted_fields .

  sql/sql_insert.cc@stripped, 2008-04-15 14:51:29-04:00, cmiller@stripped +4 -4
    Use thd->total_warn_count as the count of warnings.

  sql/sql_load.cc@stripped, 2008-04-15 14:51:29-04:00, cmiller@stripped +1 -1
    Use thd->total_warn_count as the count of warnings.

  sql/sql_table.cc@stripped, 2008-04-15 14:51:29-04:00, cmiller@stripped +1 -1
    Use thd->total_warn_count as the count of warnings.

  sql/sql_update.cc@stripped, 2008-04-15 14:51:30-04:00, cmiller@stripped +2 -2
    Use thd->total_warn_count as the count of warnings.

  tests/mysql_client_test.c@stripped, 2008-04-15 14:51:30-04:00, cmiller@stripped +45 -0
    Illustrate that (for INSERT and UPDATE), whenever mysql_info() returns
    non-NULL, that its warning count is the same as the count returned by
    mysql_warning_count().

diff -Nrup a/sql/sql_insert.cc b/sql/sql_insert.cc
--- a/sql/sql_insert.cc	2008-01-11 12:03:15 -05:00
+++ b/sql/sql_insert.cc	2008-04-15 14:51:29 -04:00
@@ -972,10 +972,10 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
     if (ignore)
       sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
 	      (lock_type == TL_WRITE_DELAYED) ? (ulong) 0 :
-	      (ulong) (info.records - info.copied), (ulong) thd->cuted_fields);
+	      (ulong) (info.records - info.copied), (ulong) thd->total_warn_count);
     else
       sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
-	      (ulong) (info.deleted + updated), (ulong) thd->cuted_fields);
+	      (ulong) (info.deleted + updated), (ulong) thd->total_warn_count);
     thd->row_count_func= info.copied + info.deleted + updated;
     ::send_ok(thd, (ulong) thd->row_count_func, id, buff);
   }
@@ -2998,10 +2998,10 @@ bool select_insert::send_eof()
   char buff[160];
   if (info.ignore)
     sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
-	    (ulong) (info.records - info.copied), (ulong) thd->cuted_fields);
+	    (ulong) (info.records - info.copied), (ulong) thd->total_warn_count);
   else
     sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
-	    (ulong) (info.deleted+info.updated), (ulong) thd->cuted_fields);
+	    (ulong) (info.deleted+info.updated), (ulong) thd->total_warn_count);
   thd->row_count_func= info.copied + info.deleted +
                        ((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
                         info.touched : info.updated);
diff -Nrup a/sql/sql_load.cc b/sql/sql_load.cc
--- a/sql/sql_load.cc	2007-10-29 09:20:55 -04:00
+++ b/sql/sql_load.cc	2008-04-15 14:51:29 -04:00
@@ -474,7 +474,7 @@ bool mysql_load(THD *thd,sql_exchange *e
     goto err;
   }
   sprintf(name, ER(ER_LOAD_INFO), (ulong) info.records, (ulong) info.deleted,
-	  (ulong) (info.records - info.copied), (ulong) thd->cuted_fields);
+	  (ulong) (info.records - info.copied), (ulong) thd->total_warn_count);
 
   if (thd->transaction.stmt.modified_non_trans_table)
     thd->transaction.all.modified_non_trans_table= TRUE;
diff -Nrup a/sql/sql_table.cc b/sql/sql_table.cc
--- a/sql/sql_table.cc	2008-01-23 10:01:29 -05:00
+++ b/sql/sql_table.cc	2008-04-15 14:51:29 -04:00
@@ -4020,7 +4020,7 @@ view_err:
 end_temporary:
   my_snprintf(tmp_name, sizeof(tmp_name), ER(ER_INSERT_INFO),
 	      (ulong) (copied + deleted), (ulong) deleted,
-	      (ulong) thd->cuted_fields);
+	      (ulong) thd->total_warn_count);
   send_ok(thd, copied + deleted, 0L, tmp_name);
   thd->some_tables_deleted=0;
   DBUG_RETURN(FALSE);
diff -Nrup a/sql/sql_update.cc b/sql/sql_update.cc
--- a/sql/sql_update.cc	2007-11-06 06:27:43 -05:00
+++ b/sql/sql_update.cc	2008-04-15 14:51:30 -04:00
@@ -596,7 +596,7 @@ int mysql_update(THD *thd,
   {
     char buff[STRING_BUFFER_USUAL_SIZE];
     sprintf(buff, ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated,
-	    (ulong) thd->cuted_fields);
+	    (ulong) thd->total_warn_count);
     thd->row_count_func=
       (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
     send_ok(thd, (ulong) thd->row_count_func,
@@ -1764,7 +1764,7 @@ bool multi_update::send_eof()
 
 
   sprintf(buff, ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated,
-	  (ulong) thd->cuted_fields);
+	  (ulong) thd->total_warn_count);
   thd->row_count_func=
     (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
   ::send_ok(thd, (ulong) thd->row_count_func,
diff -Nrup a/tests/mysql_client_test.c b/tests/mysql_client_test.c
--- a/tests/mysql_client_test.c	2007-12-01 04:12:28 -05:00
+++ b/tests/mysql_client_test.c	2008-04-15 14:51:30 -04:00
@@ -16152,6 +16152,50 @@ static void test_bug31669()
   DBUG_VOID_RETURN;
 }
 
+
+/**
+  Bug#34898: mysql_info() reports 0 warnings while mysql_warning_count() reports 1.
+*/
+
+#define BUG34898_VERIFY(q) \
+do {  \
+  char warning_count_rendered[50], *info; \
+  myquery(mysql_query(mysql, q)); \
+  info = (char *) mysql_info(mysql); \
+  if (! opt_silent) \
+    printf("q: %s\n", q); \
+  if (info != NULL) \
+  { \
+    sprintf(warning_count_rendered, "Warnings: %u", mysql_warning_count(mysql)); \
+    if (! opt_silent) \
+      printf("mysql_warning_count() %s;   mysql_info() == \"%s\"\n", warning_count_rendered, info); \
+    DBUG_ASSERT(strstr(info, warning_count_rendered) != NULL); \
+  } \
+  else if (! opt_silent) { printf("info is NULL\n"); } \
+} while (FALSE)
+
+//  else
+//    DBUG_ASSERT(mysql_warning_count(mysql) == 0);
+
+static void test_bug34898()
+{
+  DBUG_ENTER("test_bug29306");
+  myheader("test_bug29306");
+
+  BUG34898_VERIFY("create table if not exists bug34898 (id int not null auto_increment primary key, data varchar(4))");
+  BUG34898_VERIFY("delete from bug34898");
+  BUG34898_VERIFY("insert into bug34898 (data) values ('a'),(1),(NULL)");
+  BUG34898_VERIFY("insert into bug34898 (data) values ('a'+3),('a'+4)");
+  BUG34898_VERIFY("insert into bug34898 (data) values (1),(1)");
+  BUG34898_VERIFY("insert into bug34898 (data) values ('1234truncated'),('1234truncated')");
+  BUG34898_VERIFY("insert into bug34898 (data) values (default),(default),(default)");
+  BUG34898_VERIFY("update bug34898 set data=2 where data = 'a'");
+  BUG34898_VERIFY("update bug34898 set data=2 where data = 'a'+3");
+  BUG34898_VERIFY("drop table bug34898");
+
+  DBUG_VOID_RETURN;
+}
+
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -16446,6 +16490,7 @@ static struct my_tests_st my_tests[]= {
   { "test_bug29948", test_bug29948 },
   { "test_bug29306", test_bug29306 },
   { "test_bug31669", test_bug31669 },
+  { "test_bug34898", test_bug34898 },
   { 0, 0 }
 };
 
Thread
bk commit into 5.0 tree (cmiller:1.2580) BUG#34898Chad MILLER15 Apr