Below is the list of changes that have just been committed into a local
5.0 repository of hf. When hf 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, 2006-12-06 12:06:04+04:00, holyfoot@stripped +1 -0
bug #16546 (DATETIME+0 not always coerced the same way)
fix for cast( AS DATETIME)+0 in 5.0 and above versions.
val_real now works using val_decimal for DATETIME Items
sql/item_timefunc.h@stripped, 2006-12-06 12:06:01+04:00, holyfoot@stripped +9 -3
val_real() for datetime functions implemented
as { return val_real_from_decimal(); }
It's not a fastest possible way, but code is simple and less
error-prone, what i belive is more important here as this part
works unfrequently.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: holyfoot
# Host: deer.(none)
# Root: /home/hf/work/16546/my50-16546
--- 1.71/sql/item_timefunc.h 2006-12-06 12:06:11 +04:00
+++ 1.72/sql/item_timefunc.h 2006-12-06 12:06:11 +04:00
@@ -331,7 +331,7 @@ public:
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
String *val_str(String *str);
longlong val_int();
- double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
+ double val_real() { return val_real_from_decimal(); }
const char *func_name() const { return "date"; }
void fix_length_and_dec()
{
@@ -369,6 +369,7 @@ public:
return (new Field_datetime(maybe_null, name, t_arg, &my_charset_bin));
}
bool result_as_longlong() { return TRUE; }
+ double val_real() { return (double) val_int(); }
my_decimal *val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
@@ -391,13 +392,14 @@ public:
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
void fix_length_and_dec()
{
- decimals=0;
+ decimals= DATETIME_DEC;
max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
}
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_time(maybe_null, name, t_arg, &my_charset_bin));
}
+ double val_real() { return val_real_from_decimal(); }
my_decimal *val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
@@ -662,7 +664,6 @@ public:
Item_str_timefunc::fix_length_and_dec();
collation.set(&my_charset_bin);
maybe_null=1;
- decimals= DATETIME_DEC;
}
const char *func_name() const { return "sec_to_time"; }
bool result_as_longlong() { return TRUE; }
@@ -801,6 +802,7 @@ public:
}
bool result_as_longlong() { return TRUE; }
longlong val_int();
+ double val_real() { return (double) val_int(); }
my_decimal *val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
@@ -828,6 +830,7 @@ public:
}
bool result_as_longlong() { return TRUE; }
longlong val_int();
+ double val_real() { return val_real_from_decimal(); }
my_decimal *val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
@@ -859,6 +862,7 @@ public:
}
bool result_as_longlong() { return TRUE; }
longlong val_int();
+ double val_real() { return val_real_from_decimal(); }
my_decimal *val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
@@ -887,6 +891,7 @@ public:
return (new Field_date(maybe_null, name, t_arg, &my_charset_bin));
}
longlong val_int();
+ double val_real() { return val_real_from_decimal(); }
my_decimal *val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
@@ -927,6 +932,7 @@ public:
}
void print(String *str);
const char *func_name() const { return "add_time"; }
+ double val_real() { return val_real_from_decimal(); }
my_decimal *val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
| Thread |
|---|
| • bk commit into 5.0 tree (holyfoot:1.2326) BUG#16546 | holyfoot | 6 Dec |