Loading mysql-test/r/date_formats.result +9 −0 Original line number Diff line number Diff line Loading @@ -464,3 +464,12 @@ d1 d2 02 February 01 January drop table t1; select str_to_date( 1, NULL ); str_to_date( 1, NULL ) NULL select str_to_date( NULL, 1 ); str_to_date( NULL, 1 ) NULL select str_to_date( 1, IF(1=1,NULL,NULL) ); str_to_date( 1, IF(1=1,NULL,NULL) ) NULL mysql-test/t/date_formats.test +7 −0 Original line number Diff line number Diff line Loading @@ -268,4 +268,11 @@ insert into t1 (f1) values ("2005-01-01"); insert into t1 (f1) values ("2005-02-01"); select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M"); drop table t1; # # Bug #15828 # select str_to_date( 1, NULL ); select str_to_date( NULL, 1 ); select str_to_date( 1, IF(1=1,NULL,NULL) ); # End of 4.1 tests sql/item_timefunc.cc +2 −2 Original line number Diff line number Diff line Loading @@ -2750,9 +2750,9 @@ void Item_func_str_to_date::fix_length_and_dec() cached_field_type= MYSQL_TYPE_STRING; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; if ((const_item= args[1]->const_item())) { format= args[1]->val_str(&format_str); if (!args[1]->null_value && (const_item= args[1]->const_item())) { cached_format_type= get_date_time_result_type(format->ptr(), format->length()); switch (cached_format_type) { Loading Loading
mysql-test/r/date_formats.result +9 −0 Original line number Diff line number Diff line Loading @@ -464,3 +464,12 @@ d1 d2 02 February 01 January drop table t1; select str_to_date( 1, NULL ); str_to_date( 1, NULL ) NULL select str_to_date( NULL, 1 ); str_to_date( NULL, 1 ) NULL select str_to_date( 1, IF(1=1,NULL,NULL) ); str_to_date( 1, IF(1=1,NULL,NULL) ) NULL
mysql-test/t/date_formats.test +7 −0 Original line number Diff line number Diff line Loading @@ -268,4 +268,11 @@ insert into t1 (f1) values ("2005-01-01"); insert into t1 (f1) values ("2005-02-01"); select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M"); drop table t1; # # Bug #15828 # select str_to_date( 1, NULL ); select str_to_date( NULL, 1 ); select str_to_date( 1, IF(1=1,NULL,NULL) ); # End of 4.1 tests
sql/item_timefunc.cc +2 −2 Original line number Diff line number Diff line Loading @@ -2750,9 +2750,9 @@ void Item_func_str_to_date::fix_length_and_dec() cached_field_type= MYSQL_TYPE_STRING; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; if ((const_item= args[1]->const_item())) { format= args[1]->val_str(&format_str); if (!args[1]->null_value && (const_item= args[1]->const_item())) { cached_format_type= get_date_time_result_type(format->ptr(), format->length()); switch (cached_format_type) { Loading