summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 7ca85a72cfa..057d75676dc 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
@@ -721,31 +721,31 @@ bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type,
const char *warn_name, MYSQL_TIME *l_time)
{
bool value;
- int error;
- enum_mysql_timestamp_type timestamp_type;
+ MYSQL_TIME_STATUS status;
int flags= TIME_FUZZY_DATE | MODE_INVALID_DATES;
ErrConvString err(str);
- if (warn_type == MYSQL_TIMESTAMP_TIME)
- flags|= TIME_TIME_ONLY;
-
- timestamp_type=
- str_to_datetime(str->charset(), str->ptr(), str->length(),
- l_time, flags, &error);
+ DBUG_ASSERT(warn_type != MYSQL_TIMESTAMP_TIME);
- if (timestamp_type > MYSQL_TIMESTAMP_ERROR)
+ if (!str_to_datetime(str->charset(), str->ptr(), str->length(),
+ l_time, flags, &status))
+ {
+ DBUG_ASSERT(l_time->time_type == MYSQL_TIMESTAMP_DATETIME ||
+ l_time->time_type == MYSQL_TIMESTAMP_DATE);
/*
Do not return yet, we may still want to throw a "trailing garbage"
warning.
*/
value= FALSE;
+ }
else
{
+ DBUG_ASSERT(l_time->time_type != MYSQL_TIMESTAMP_TIME);
+ DBUG_ASSERT(status.warnings != 0); // Must be set by set_to_datetime()
value= TRUE;
- error= 1; /* force warning */
}
- if (error > 0)
+ if (status.warnings > 0)
make_truncated_value_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
&err, warn_type, warn_name);
@@ -4352,7 +4352,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
with_sum_func= with_sum_func || item->with_sum_func;
with_field= with_field || item->with_field;
- with_subselect|= item->with_subselect;
+ with_subselect|= item->has_subquery();
if (item->maybe_null)
maybe_null=1;
}
@@ -5052,7 +5052,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref)
return TRUE; /* purecov: inspected */
with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func;
with_field= args[0]->with_field || args[1]->with_field;
- with_subselect|= args[0]->with_subselect | args[1]->with_subselect;
+ with_subselect= args[0]->has_subquery() || args[1]->has_subquery();
max_length= 1;
decimals= 0;