summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorkaren.langford@oracle.com <>2011-02-08 12:52:33 +0100
committerKaren Langford <karen.langford@oracle.com>2011-02-08 12:52:33 +0100
commitc85029f83b0b6d4c7c37a4e1ec6a8d811302a4ae (patch)
tree07f8c2be8340694279693caa7339c671b43cb30e /sql/item_cmpfunc.cc
parentaa672f5401d86bacb6281b96e170752a43f13acc (diff)
parenta3acdfacd155a3561ce30da2140cd4c216bfe1c8 (diff)
downloadmariadb-git-c85029f83b0b6d4c7c37a4e1ec6a8d811302a4ae.tar.gz
Merge from mysql-5.1.55-release
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 40056cfd1ef..36ca5537eb5 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1196,9 +1196,12 @@ get_year_value(THD *thd, Item ***item_arg, Item **cache_arg,
value of 2000.
*/
Item *real_item= item->real_item();
- if (!(real_item->type() == Item::FIELD_ITEM &&
- ((Item_field *)real_item)->field->type() == MYSQL_TYPE_YEAR &&
- ((Item_field *)real_item)->field->field_length == 4))
+ Field *field= NULL;
+ if (real_item->type() == Item::FIELD_ITEM)
+ field= ((Item_field *)real_item)->field;
+ else if (real_item->type() == Item::CACHE_ITEM)
+ field= ((Item_cache *)real_item)->field();
+ if (!(field && field->type() == MYSQL_TYPE_YEAR && field->field_length == 4))
{
if (value < 70)
value+= 100;