summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-05-07 13:37:16 +0400
committerAlexander Nozdrin <alik@sun.com>2010-05-07 13:37:16 +0400
commit762b535de2104cd08b10a1a41f16f9df1371b95d (patch)
tree385aedcde4e00b31a7b5e1b308d16b5460be7b94 /sql/item.cc
parent21b8741b57204f784633c6337f9abacaa59ff3e2 (diff)
parent7af6ac8f3ed64333f3dcb87c15e93bcfafd66bf1 (diff)
downloadmariadb-git-762b535de2104cd08b10a1a41f16f9df1371b95d.tar.gz
Manual merge from mysql-trunk.
Conflicts: - mysql-test/suite/engines/funcs/t/disabled.def - mysql-test/suite/engines/iuds/t/disabled.def - mysql-test/suite/engines/iuds/t/insert_number.test
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 49a4c1c920d..fb2889aad87 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1796,6 +1796,24 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
&dummy_offset))
continue;
+ /*
+ No needs to add converter if an "arg" is NUMERIC or DATETIME
+ value (which is pure ASCII) and at the same time target DTCollation
+ is ASCII-compatible. For example, no needs to rewrite:
+ SELECT * FROM t1 WHERE datetime_field = '2010-01-01';
+ to
+ SELECT * FROM t1 WHERE CONVERT(datetime_field USING cs) = '2010-01-01';
+
+ TODO: avoid conversion of any values with
+ repertoire ASCII and 7bit-ASCII-compatible,
+ not only numeric/datetime origin.
+ */
+ if ((*arg)->collation.derivation == DERIVATION_NUMERIC &&
+ (*arg)->collation.repertoire == MY_REPERTOIRE_ASCII &&
+ !((*arg)->collation.collation->state & MY_CS_NONASCII) &&
+ !(coll.collation->state & MY_CS_NONASCII))
+ continue;
+
if (!(conv= (*arg)->safe_charset_converter(coll.collation)) &&
((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII))
{
@@ -5422,7 +5440,7 @@ int Item::save_in_field(Field *field, bool no_conversions)
{
double nr= val_real();
if (null_value)
- return set_field_to_null(field);
+ return set_field_to_null_with_conversions(field, no_conversions);
field->set_notnull();
error=field->store(nr);
}