summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 73390e3d6e1..630a408b13f 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2010, 2021, MariaDB Corporation.
+ Copyright (c) 2010, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -7112,6 +7112,25 @@ Item_bin_string::Item_bin_string(THD *thd, const char *str, size_t str_length):
}
+void Item_bin_string::print(String *str, enum_query_type query_type)
+{
+ if (!str_value.length())
+ {
+ /*
+ Historically a bit string such as b'01100001'
+ prints itself in the hex hybrid notation: 0x61
+ In case of an empty bit string b'', the hex hybrid
+ notation would result in a bad syntax: 0x
+ So let's print empty bit strings using bit string notation: b''
+ */
+ static const LEX_CSTRING empty_bit_string= {STRING_WITH_LEN("b''")};
+ str->append(empty_bit_string);
+ }
+ else
+ Item_hex_hybrid::print(str, query_type);
+}
+
+
void Item_date_literal::print(String *str, enum_query_type query_type)
{
str->append("DATE'");