diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2011-01-10 15:08:31 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2011-01-10 15:08:31 +0100 |
commit | b56308e63d74c619c4fe8b765c3745e728d804c8 (patch) | |
tree | 23ed20d7372307636b325211cd801777b7e6e0d0 /sql/item_func.h | |
parent | a5263d0afb65fabc98cea354e3e5769f1f2b942e (diff) | |
parent | 2f4741667867accad41d6b2d2a9ac67851ad35c0 (diff) | |
download | mariadb-git-b56308e63d74c619c4fe8b765c3745e728d804c8.tar.gz |
Manual merge from 5.1
Diffstat (limited to 'sql/item_func.h')
-rw-r--r-- | sql/item_func.h | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/sql/item_func.h b/sql/item_func.h index 1139442fe76..937907c9404 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -237,6 +237,7 @@ public: { return (error == E_DEC_OVERFLOW) ? raise_decimal_overflow() : error; } + bool has_timestamp_args() { DBUG_ASSERT(fixed == TRUE); @@ -248,6 +249,45 @@ public: } return FALSE; } + + bool has_date_args() + { + DBUG_ASSERT(fixed == TRUE); + for (uint i= 0; i < arg_count; i++) + { + if (args[i]->type() == Item::FIELD_ITEM && + (args[i]->field_type() == MYSQL_TYPE_DATE || + args[i]->field_type() == MYSQL_TYPE_DATETIME)) + return TRUE; + } + return FALSE; + } + + bool has_time_args() + { + DBUG_ASSERT(fixed == TRUE); + for (uint i= 0; i < arg_count; i++) + { + if (args[i]->type() == Item::FIELD_ITEM && + (args[i]->field_type() == MYSQL_TYPE_TIME || + args[i]->field_type() == MYSQL_TYPE_DATETIME)) + return TRUE; + } + return FALSE; + } + + bool has_datetime_args() + { + DBUG_ASSERT(fixed == TRUE); + for (uint i= 0; i < arg_count; i++) + { + if (args[i]->type() == Item::FIELD_ITEM && + args[i]->field_type() == MYSQL_TYPE_DATETIME) + return TRUE; + } + return FALSE; + } + /* We assume the result of any function that has a TIMESTAMP argument to be timezone-dependent, since a TIMESTAMP value in both numeric and string @@ -256,7 +296,7 @@ public: representation of a TIMESTAMP argument verbatim, and thus does not depend on the timezone. */ - virtual bool is_timezone_dependent_processor(uchar *bool_arg) + virtual bool check_valid_arguments_processor(uchar *bool_arg) { return has_timestamp_args(); } |