[Commits] Rev 3493: fixed CHECK fumction (MDEV-559) in file:///home/bell/maria/bzr/work-maria-5.5-dnames/

sanja at montyprogram.com sanja at montyprogram.com
Fri Sep 28 09:42:22 EEST 2012


At file:///home/bell/maria/bzr/work-maria-5.5-dnames/

------------------------------------------------------------
revno: 3493
revision-id: sanja at montyprogram.com-20120928064220-2agamglhhyzw3uqs
parent: sanja at askmonty.org-20120924141218-rxxkg9trqayzd43z
committer: sanja at montyprogram.com
branch nick: work-maria-5.5-dnames
timestamp: Fri 2012-09-28 09:42:20 +0300
message:
  fixed CHECK fumction (MDEV-559)
-------------- next part --------------
=== modified file 'mysql-test/r/dyncol.result'
--- a/mysql-test/r/dyncol.result	2012-09-22 18:58:47 +0000
+++ b/mysql-test/r/dyncol.result	2012-09-28 06:42:20 +0000
@@ -1562,3 +1562,18 @@ column_json(column_create("int", -1212 a
 select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date));
 column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date))
 [{"1":-1212},{"2":12334},{"3":23.344},{"4":"1.23444e+50"},{"5":"gdgd\\dhdjh\"dhdhd"},{"6":"00:45:49.000001"},{"7":"2011-04-05 00:45:49.000001"},{"8":"2011-04-05"}]
+#
+# CHECK test
+#
+SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a'));
+COLUMN_CHECK(COLUMN_CREATE(1,'a'))
+1
+SELECT COLUMN_CHECK('abracadabra');
+COLUMN_CHECK('abracadabra')
+0
+SELECT COLUMN_CHECK('');
+COLUMN_CHECK('')
+1
+SELECT COLUMN_CHECK(NULL);
+COLUMN_CHECK(NULL)
+NULL

=== modified file 'mysql-test/t/dyncol.test'
--- a/mysql-test/t/dyncol.test	2012-09-22 18:58:47 +0000
+++ b/mysql-test/t/dyncol.test	2012-09-28 06:42:20 +0000
@@ -664,3 +664,11 @@ SELECT hex(COLUMN_CREATE(REPEAT('a',256)
 --echo #
 select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date));
 select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date));
+
+--echo #
+--echo # CHECK test
+--echo #
+SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a'));
+SELECT COLUMN_CHECK('abracadabra');
+SELECT COLUMN_CHECK('');
+SELECT COLUMN_CHECK(NULL);

=== modified file 'mysys/ma_dyncol.c'
--- a/mysys/ma_dyncol.c	2012-09-24 14:12:18 +0000
+++ b/mysys/ma_dyncol.c	2012-09-28 06:42:20 +0000
@@ -3302,7 +3302,7 @@ dynamic_column_check(DYNAMIC_COLUMN *str
     key= &name;
     prev_key= &prev_name;
   }
-  for (i= 0, header.entry= header.dtpool;
+  for (i= 0, header.entry= header.header;
        i < header.column_count;
        i++, header.entry+= header.entry_size)
   {
@@ -3378,7 +3378,7 @@ dynamic_column_check(DYNAMIC_COLUMN *str
   }
 
   /* check data, which we can */
-  for (i= 0, header.entry= header.dtpool;
+  for (i= 0, header.entry= header.header;
        i < header.column_count;
        i++, header.entry+= header.entry_size)
   {

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2012-09-20 15:21:29 +0000
+++ b/sql/item_cmpfunc.cc	2012-09-28 06:42:20 +0000
@@ -6057,19 +6057,19 @@ longlong Item_func_dyncol_check::val_int
   enum enum_dyncol_func_result rc;
 
   str= args[0]->val_str(&tmp);
-  if (args[0]->null_value || args[1]->null_value)
+  if (args[0]->null_value)
     goto null;
   col.length= str->length();
   /* We do not change the string, so could do this trick */
   col.str= (char *)str->ptr();
   rc= dynamic_column_check(&col);
-  if (rc < 0)
+  if (rc < 0 && rc != ER_DYNCOL_FORMAT)
   {
     dynamic_column_error_message(rc);
     goto null;
   }
   null_value= FALSE;
-  return rc == ER_DYNCOL_YES;
+  return rc == ER_DYNCOL_OK;
 
 null:
   null_value= TRUE;



More information about the commits mailing list