summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMartin Hansson <martin.hansson@sun.com>2010-03-16 10:20:07 +0100
committerMartin Hansson <martin.hansson@sun.com>2010-03-16 10:20:07 +0100
commit0ed46845479e5d1f995ee6c16cdad7dd4cb43317 (patch)
treeb9e07ec4f746b3b7eb0e0308b3173625a842a1e7 /sql
parent9fc32c2e2441d254ec21d5b0541e468f9d9dd149 (diff)
downloadmariadb-git-0ed46845479e5d1f995ee6c16cdad7dd4cb43317.tar.gz
Bug#50918: Date columns treated differently in Views than in
Base Tables The type inferrence of a view column caused the result to be interpreted as the wrong type: DATE colums were interpreted as TIME and TIME as DATETIME. This happened because view columns are represented by Item_ref objects as opposed to Item_field's. Item_ref had no method for retrieving a TIME value and thus was forced to depend on the default implementation for any expression, which caused the expression to be evaluated as a string and then parsed into a TIME/DATETIME value. Fixed by letting Item_ref classes forward the request for a TIME value to the referred Item - which is a field in this case - this reads the TIME value directly without conversion.
Diffstat (limited to 'sql')
-rw-r--r--sql/item.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h
index 34416feeb21..d2303853743 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2320,6 +2320,11 @@ public:
if (ref && result_type() == ROW_RESULT)
(*ref)->bring_value();
}
+ bool get_time(MYSQL_TIME *ltime)
+ {
+ DBUG_ASSERT(fixed);
+ return (*ref)->get_time(ltime);
+ }
};