summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-12-13 11:37:33 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-12-13 11:37:33 +0200
commitfdf43b5c78c4aeb26efdbef3172746e007ab6f1d (patch)
tree7497fd0a024da01b2ade9c45e484a9d004a3f13b /sql/item.cc
parent382e85fe70cfffb6c7190c627647c19aed3912a5 (diff)
parent8f30973234de520d95dfccca8409e5802b845331 (diff)
downloadmariadb-git-fdf43b5c78c4aeb26efdbef3172746e007ab6f1d.tar.gz
Merge 10.3 into 10.4
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'");