Fix for hour.cc:
=== modified file 'drizzled/function/time/hour.cc' --- drizzled/function/time/hour.cc 2010-02-04 08:14:46 +0000 +++ drizzled/function/time/hour.cc 2010-09-09 17:38:41 +0000 @@ -57,7 +57,13 @@ char time_buff[DRIZZLE_MAX_LENGTH_DATETIME_AS_STRING]; String tmp_time(time_buff,sizeof(time_buff), &my_charset_utf8_bin); String *time_res= args[0]->val_str(&tmp_time); - if (! temporal_time.from_string(time_res->c_ptr(), time_res->length())) + if (time_res && time_res != &tmp_time) + { + tmp_time.copy(*time_res); + } + + + if (! temporal_time.from_string(tmp_time.c_ptr(), tmp_time.length())) { /* * OK, we failed to match the first argument as a string @@ -83,7 +89,12 @@ char buff[DRIZZLE_MAX_LENGTH_DATETIME_AS_STRING]; String tmp(buff,sizeof(buff), &my_charset_utf8_bin); String *res= args[0]->val_str(&tmp); - if (! temporal_datetime.from_string(res->c_ptr(), res->length())) + if (res && res != &tmp) + { + tmp.copy(*res); + } + + if (! temporal_datetime.from_string(tmp.c_ptr(), tmp.length())) { /* * Could not interpret the function argument as a temporal value, @@ -111,7 +122,12 @@
res= args[0]->val_str(&tmp);
- my_error(ER_INVALID_DATETIME_VALUE, MYF(0), res->c_ptr()); + if (res && res != &tmp) + { + tmp.copy(*res); + } + + my_error(ER_INVALID_DATETIME_VALUE, MYF(0), tmp.c_ptr()); return 0; } }
Fix for hour.cc:
=== modified file 'drizzled/ function/ time/hour. cc' function/ time/hour. cc 2010-02-04 08:14:46 +0000 function/ time/hour. cc 2010-09-09 17:38:41 +0000 DRIZZLE_ MAX_LENGTH_ DATETIME_ AS_STRING] ; time_buff, sizeof( time_buff) , &my_charset_ utf8_bin) ; ->val_str( &tmp_time) ; time.from_ string( time_res- >c_ptr( ), time_res- >length( ))) copy(*time_ res); time.from_ string( tmp_time. c_ptr() , tmp_time.length())) MAX_LENGTH_ DATETIME_ AS_STRING] ; sizeof( buff), &my_charset_ utf8_bin) ; ->val_str( &tmp); datetime. from_string( res->c_ ptr(), res->length())) datetime. from_string( tmp.c_ptr( ), tmp.length()))
--- drizzled/
+++ drizzled/
@@ -57,7 +57,13 @@
char time_buff[
String tmp_time(
String *time_res= args[0]
- if (! temporal_
+ if (time_res && time_res != &tmp_time)
+ {
+ tmp_time.
+ }
+
+
+ if (! temporal_
{
/*
* OK, we failed to match the first argument as a string
@@ -83,7 +89,12 @@
char buff[DRIZZLE_
String tmp(buff,
String *res= args[0]
- if (! temporal_
+ if (res && res != &tmp)
+ {
+ tmp.copy(*res);
+ }
+
+ if (! temporal_
{
/*
* Could not interpret the function argument as a temporal value,
@@ -111,7 +122,12 @@
res= args[0] ->val_str( &tmp);
- my_error( ER_INVALID_ DATETIME_ VALUE, MYF(0), res->c_ptr()); ER_INVALID_ DATETIME_ VALUE, MYF(0), tmp.c_ptr());
+ if (res && res != &tmp)
+ {
+ tmp.copy(*res);
+ }
+
+ my_error(
return 0;
}
}