Commit e5f077f7 authored by unknown's avatar unknown

date_formats.test:

  fix for bug #15828 after review
  doing val_str now before testing of null value secures the function for null values returned by dynamic functions - the fix before was incomplete andy covered constant null values


mysql-test/t/date_formats.test:
  fix for bug #15828 after review
  doing val_str now before testing of null value secures the function for null values returned by dynamic functions - the fix before was incomplete andy covered constant null values
parent 37b104b8
...@@ -470,3 +470,6 @@ NULL ...@@ -470,3 +470,6 @@ NULL
select str_to_date( NULL, 1 ); select str_to_date( NULL, 1 );
str_to_date( NULL, 1 ) str_to_date( NULL, 1 )
NULL NULL
select str_to_date( 1, IF(1=1,NULL,NULL) );
str_to_date( 1, IF(1=1,NULL,NULL) )
NULL
...@@ -274,5 +274,5 @@ drop table t1; ...@@ -274,5 +274,5 @@ drop table t1;
# #
select str_to_date( 1, NULL ); select str_to_date( 1, NULL );
select str_to_date( NULL, 1 ); select str_to_date( NULL, 1 );
select str_to_date( 1, IF(1=1,NULL,NULL) );
# End of 4.1 tests # End of 4.1 tests
...@@ -2750,9 +2750,9 @@ void Item_func_str_to_date::fix_length_and_dec() ...@@ -2750,9 +2750,9 @@ void Item_func_str_to_date::fix_length_and_dec()
cached_field_type= MYSQL_TYPE_STRING; cached_field_type= MYSQL_TYPE_STRING;
max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
cached_timestamp_type= MYSQL_TIMESTAMP_NONE; cached_timestamp_type= MYSQL_TIMESTAMP_NONE;
format= args[1]->val_str(&format_str);
if (!args[1]->null_value && (const_item= args[1]->const_item())) if (!args[1]->null_value && (const_item= args[1]->const_item()))
{ {
format= args[1]->val_str(&format_str);
cached_format_type= get_date_time_result_type(format->ptr(), cached_format_type= get_date_time_result_type(format->ptr(),
format->length()); format->length());
switch (cached_format_type) { switch (cached_format_type) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment