summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-07-13 19:36:10 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-07-13 19:36:10 +0500
commitfde9c7d5b8ce11a126e586b7cd216a0d1962d3b6 (patch)
treeae381d395c7ae8ceab1ab3c80e277730c30de334 /sql/field_conv.cc
parentf1ae9c3923796e598442ace988d5f29ee08f14a4 (diff)
parent2a0498c0f9a67676aedef2699fe5a14150ce5f4d (diff)
downloadmariadb-git-fde9c7d5b8ce11a126e586b7cd216a0d1962d3b6.tar.gz
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt mysql-test/r/create_not_windows.result: Auto merged mysql-test/r/join_nested.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/r/type_ranges.result: Auto merged mysql-test/r/type_time.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/create_not_windows.test: Auto merged mysql-test/t/symlink.test: Auto merged sql/item_cmpfunc.cc: Auto merged sql/sql_select.cc: Auto merged mysql-test/r/create.result: Merge with 5.0-opt. mysql-test/r/type_enum.result: Merge with 5.0-opt. mysql-test/t/type_enum.test: Merge with 5.0-opt. sql/field_conv.cc: Merge with 5.0-opt.
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 44aea9acee0..33c7897c3db 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -795,11 +795,18 @@ int field_conv(Field *to,Field *from)
blob->value.copy();
return blob->store(blob->value.ptr(),blob->value.length(),from->charset());
}
- if ((from->result_type() == STRING_RESULT &&
- (to->result_type() == STRING_RESULT ||
- (from->real_type() != MYSQL_TYPE_ENUM &&
- from->real_type() != MYSQL_TYPE_SET))) ||
- to->type() == MYSQL_TYPE_DECIMAL)
+ if (from->real_type() == MYSQL_TYPE_ENUM &&
+ to->real_type() == MYSQL_TYPE_ENUM &&
+ from->val_int() == 0)
+ {
+ ((Field_enum *)(to))->store_type(0);
+ return 0;
+ }
+ else if ((from->result_type() == STRING_RESULT &&
+ (to->result_type() == STRING_RESULT ||
+ (from->real_type() != MYSQL_TYPE_ENUM &&
+ from->real_type() != MYSQL_TYPE_SET))) ||
+ to->type() == MYSQL_TYPE_DECIMAL)
{
char buff[MAX_FIELD_WIDTH];
String result(buff,sizeof(buff),from->charset());