summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2014-09-03 01:56:21 +0400
committerAlexander Barkov <bar@mariadb.org>2014-09-03 01:56:21 +0400
commitfbaaf3688d5fac4b1b867155a9f09575367c0f98 (patch)
tree0e36d7dca37e6775e113c0547823dcd12ee502fe /sql/sql_yacc.yy
parent658a1e9420b062f767316ecf1dcb4b2837dfa27a (diff)
downloadmariadb-git-fbaaf3688d5fac4b1b867155a9f09575367c0f98.tar.gz
Moving Item::str_value from public to protected.
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy29
1 files changed, 5 insertions, 24 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 19df69289ac..ef71369ac66 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -9195,7 +9195,6 @@ simple_expr:
}
| '{' ident expr '}'
{
- Item_string *item;
$$= NULL;
/*
If "expr" is reasonably short pure ASCII string literal,
@@ -9205,31 +9204,13 @@ simple_expr:
SELECT {t'10:20:30'};
SELECT {ts'2001-01-01 10:20:30'};
*/
- if ($3->type() == Item::STRING_ITEM &&
- (item= (Item_string *) $3) &&
- item->collation.repertoire == MY_REPERTOIRE_ASCII &&
- item->str_value.length() < MAX_DATE_STRING_REP_LENGTH * 4)
- {
- enum_field_types type= MYSQL_TYPE_STRING;
- LEX_STRING *ls= &$2;
- if (ls->length == 1)
- {
- if (ls->str[0] == 'd') /* {d'2001-01-01'} */
- type= MYSQL_TYPE_DATE;
- else if (ls->str[0] == 't') /* {t'10:20:30'} */
- type= MYSQL_TYPE_TIME;
- }
- else if (ls->length == 2) /* {ts'2001-01-01 10:20:30'} */
- {
- if (ls->str[0] == 't' && ls->str[1] == 's')
- type= MYSQL_TYPE_DATETIME;
- }
+ if ($3->type() == Item::STRING_ITEM)
+ {
+ Item_string *item= (Item_string *) $3;
+ enum_field_types type= item->odbc_temporal_literal_type(&$2);
if (type != MYSQL_TYPE_STRING)
{
- $$= create_temporal_literal(thd,
- item->str_value.ptr(),
- item->str_value.length(),
- item->str_value.charset(),
+ $$= create_temporal_literal(thd, item->val_str(NULL),
type, false);
}
}