summaryrefslogtreecommitdiff
path: root/plugin/type_inet/sql_type_inet.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-10-11 22:19:30 +0400
committerAlexander Barkov <bar@mariadb.com>2019-10-11 22:19:30 +0400
commit5d6d28f274e38a7691fa30a6674452ad6c8870fd (patch)
tree558488dca5249b9d1297531c241f642b9b421112 /plugin/type_inet/sql_type_inet.cc
parentd8e599bb802f20e38dfb1515cc54ee4ab9b3b10f (diff)
downloadmariadb-git-5d6d28f274e38a7691fa30a6674452ad6c8870fd.tar.gz
MDEV-20798 Conversion from INET6 to other types performed without errors or warnings
Diffstat (limited to 'plugin/type_inet/sql_type_inet.cc')
-rw-r--r--plugin/type_inet/sql_type_inet.cc22
1 files changed, 7 insertions, 15 deletions
diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc
index 97e433cb053..7f9adf1d299 100644
--- a/plugin/type_inet/sql_type_inet.cc
+++ b/plugin/type_inet/sql_type_inet.cc
@@ -802,23 +802,15 @@ public:
int save_in_field(Field *to) override
{
// INSERT INTO t2 (different_field_type) SELECT inet6_field FROM t1;
- switch (to->cmp_type()) {
- case INT_RESULT:
- case REAL_RESULT:
- case DECIMAL_RESULT:
- case TIME_RESULT:
+ if (to->charset() == &my_charset_bin &&
+ dynamic_cast<const Type_handler_general_purpose_string*>
+ (to->type_handler()))
{
- my_decimal buff;
- return to->store_decimal(val_decimal(&buff));
+ NativeBufferInet6 res;
+ val_native(&res);
+ return to->store(res.ptr(), res.length(), &my_charset_bin);
}
- case STRING_RESULT:
- return save_in_field_str(to);
- case ROW_RESULT:
- break;
- }
- DBUG_ASSERT(0);
- to->reset();
- return 0;
+ return save_in_field_str(to);
}
Copy_func *get_copy_func(const Field *from) const override
{