summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authorgkodinov/kgeorge@macbook.gmz <>2007-02-06 11:08:57 +0200
committergkodinov/kgeorge@macbook.gmz <>2007-02-06 11:08:57 +0200
commit5092f7ab269c75273c791201eb0cc803a2f456ee (patch)
tree2c29aa1d71aa6438281906e4da3ddab01ebbe7ba /sql/field_conv.cc
parent5313db2d82f6f7bc0831ef616343d516643dbda5 (diff)
downloadmariadb-git-5092f7ab269c75273c791201eb0cc803a2f456ee.tar.gz
Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison
Ignoring error codes from type conversion allows default (wrong) values to go unnoticed in the formation of index search conditions. Fixed by correctly checking for conversion errors.
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index e5752708123..dbe58d804ad 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -679,7 +679,7 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
/* Simple quick field convert that is called on insert */
-void field_conv(Field *to,Field *from)
+int field_conv(Field *to,Field *from)
{
if (to->real_type() == from->real_type() &&
!(to->type() == FIELD_TYPE_BLOB && to->table->copy_blobs))
@@ -707,7 +707,7 @@ void field_conv(Field *to,Field *from)
if (to->ptr != from->ptr)
#endif
memcpy(to->ptr,from->ptr,to->pack_length());
- return;
+ return 0;
}
}
if (to->type() == FIELD_TYPE_BLOB)
@@ -723,8 +723,7 @@ void field_conv(Field *to,Field *from)
from->real_type() != MYSQL_TYPE_STRING &&
from->real_type() != MYSQL_TYPE_VARCHAR))
blob->value.copy();
- blob->store(blob->value.ptr(),blob->value.length(),from->charset());
- return;
+ return blob->store(blob->value.ptr(),blob->value.length(),from->charset());
}
if ((from->result_type() == STRING_RESULT &&
(to->result_type() == STRING_RESULT ||
@@ -741,15 +740,15 @@ void field_conv(Field *to,Field *from)
end with \0. Can be replaced with .ptr() when we have our own
string->double conversion.
*/
- to->store(result.c_ptr_quick(),result.length(),from->charset());
+ return to->store(result.c_ptr_quick(),result.length(),from->charset());
}
else if (from->result_type() == REAL_RESULT)
- to->store(from->val_real());
+ return to->store(from->val_real());
else if (from->result_type() == DECIMAL_RESULT)
{
my_decimal buff;
- to->store_decimal(from->val_decimal(&buff));
+ return to->store_decimal(from->val_decimal(&buff));
}
else
- to->store(from->val_int(), test(from->flags & UNSIGNED_FLAG));
+ return to->store(from->val_int(), test(from->flags & UNSIGNED_FLAG));
}