List:Commits« Previous MessageNext Message »
From:konstantin Date:August 6 2007 10:22am
Subject:bk commit into 5.0 tree (kostja:1.2488) BUG#29306
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja 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, 2007-08-06 14:22:24+04:00, kostja@bodhi.(none) +2 -0
  A fix and a test case for Bug#29306 "Truncated data in MS Access with decimal (3,1) columns in a 
  VIEW".
  
  mysql_list_fields() C API function would incorrectly set MYSQL_FIELD::decimals
  member for some view columns.
  
  The problem was in an incomplete implementation of 
  Item_ident_for_show::make_field(), which is responsible for view
  columns metadata.

  sql/item.cc@stripped, 2007-08-06 14:22:21+04:00, kostja@bodhi.(none) +1 -1
    A fix for Bug#29306 -- properly initialize decimals in 
    Item_ident_for_show::make_field

  tests/mysql_client_test.c@stripped, 2007-08-06 14:22:22+04:00, kostja@bodhi.(none) +52 -2
    Add a test case forBug#29306. Fix warnings.

diff -Nrup a/sql/item.cc b/sql/item.cc
--- a/sql/item.cc	2007-07-06 16:18:44 +04:00
+++ b/sql/item.cc	2007-08-06 14:22:21 +04:00
@@ -1621,7 +1621,7 @@ void Item_ident_for_show::make_field(Sen
   tmp_field->type=field->type();
   tmp_field->flags= field->table->maybe_null ? 
     (field->flags & ~NOT_NULL_FLAG) : field->flags;
-  tmp_field->decimals= 0;
+  tmp_field->decimals= field->decimals();
 }
 
 /**********************************************/
diff -Nrup a/tests/mysql_client_test.c b/tests/mysql_client_test.c
--- a/tests/mysql_client_test.c	2007-06-29 17:37:15 +04:00
+++ b/tests/mysql_client_test.c	2007-08-06 14:22:22 +04:00
@@ -15570,7 +15570,7 @@ static void test_bug27876()
   int rc;
   MYSQL_RES *result;
 
-  char utf8_func[] =
+  unsigned char utf8_func[] =
   {
     0xd1, 0x84, 0xd1, 0x83, 0xd0, 0xbd, 0xd0, 0xba,
     0xd1, 0x86, 0xd0, 0xb8, 0xd0, 0xb9, 0xd0, 0xba,
@@ -15578,7 +15578,7 @@ static void test_bug27876()
     0x00
   };
 
-  char utf8_param[] =
+  unsigned char utf8_param[] =
   {
     0xd0, 0xbf, 0xd0, 0xb0, 0xd1, 0x80, 0xd0, 0xb0,
     0xd0, 0xbc, 0xd0, 0xb5, 0xd1, 0x82, 0xd1, 0x8a,
@@ -15735,6 +15735,55 @@ static void test_bug27592()
 }
 
 
+/**
+  Bug#29306 Truncated data in MS Access with decimal (3,1) columns in a VIEW
+*/
+
+static void test_bug29306()
+{
+  MYSQL_FIELD *field;
+  int rc;
+  MYSQL_RES *res;
+
+  DBUG_ENTER("test_bug29306");
+  myheader("test_bug29306");
+
+  rc= mysql_query(mysql, "DROP TABLE IF EXISTS tab17557");
+  myquery(rc);
+  rc= mysql_query(mysql, "DROP VIEW IF EXISTS view17557");
+  myquery(rc);
+  rc= mysql_query(mysql, "CREATE TABLE tab17557 (dd decimal (3,1))");
+  myquery(rc);
+  rc= mysql_query(mysql, "CREATE VIEW view17557 as SELECT dd FROM tab17557");
+  myquery(rc);
+  rc= mysql_query(mysql, "INSERT INTO tab17557 VALUES (7.6)");
+  myquery(rc);
+
+  /* Checking the view */
+  res= mysql_list_fields(mysql, "view17557", NULL);
+  while ((field= mysql_fetch_field(res)))
+  {
+    if (! opt_silent)
+    {
+      printf("field name %s\n", field->name);
+      printf("field table %s\n", field->table);
+      printf("field decimals %d\n", field->decimals);
+      if (field->decimals < 1)
+        printf("Error! No decimals! \n");
+      printf("\n\n");
+    }
+    DIE_UNLESS(field->decimals == 1);
+  }
+  mysql_free_result(res);
+
+  rc= mysql_query(mysql, "DROP TABLE tab17557");
+  myquery(rc);
+  rc= mysql_query(mysql, "DROP VIEW view17557");
+  myquery(rc);
+
+  DBUG_VOID_RETURN;
+}
+
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -16019,6 +16068,7 @@ static struct my_tests_st my_tests[]= {
   { "test_bug28505", test_bug28505 },
   { "test_bug28934", test_bug28934 },
   { "test_bug27592", test_bug27592 },
+  { "test_bug29306", test_bug29306 },
   { 0, 0 }
 };
 
Thread
bk commit into 5.0 tree (kostja:1.2488) BUG#29306konstantin6 Aug