summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2007-02-06 11:08:57 +0200
committerunknown <gkodinov/kgeorge@macbook.gmz>2007-02-06 11:08:57 +0200
commitc35ceeca9e11062516bd93d10d89ac818a6e1f23 (patch)
tree2c29aa1d71aa6438281906e4da3ddab01ebbe7ba /sql/field_conv.cc
parent1534bb792ba4b8ca5806ed2953274c31fc8c8e44 (diff)
downloadmariadb-git-c35ceeca9e11062516bd93d10d89ac818a6e1f23.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. mysql-test/r/select.result: Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison - test case mysql-test/t/select.test: Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison - test case sql/field.h: Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison - don't ignore coversion errors sql/field_conv.cc: Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison - don't ignore coversion errors sql/item.cc: Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison - don't ignore coversion 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));
}