summaryrefslogtreecommitdiffstats
path: root/sql/cset_narrowing.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /sql/cset_narrowing.cc
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sql/cset_narrowing.cc')
-rw-r--r--sql/cset_narrowing.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/sql/cset_narrowing.cc b/sql/cset_narrowing.cc
new file mode 100644
index 00000000..abdaec16
--- /dev/null
+++ b/sql/cset_narrowing.cc
@@ -0,0 +1,35 @@
+/*
+ Copyright (c) 2023, 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
+
+#ifdef USE_PRAGMA_IMPLEMENTATION
+#pragma implementation // gcc: Class implementation
+#endif
+
+#include "mariadb.h"
+#include "sql_priv.h"
+#include "sql_select.h"
+
+Charset_utf8narrow utf8mb3_from_mb4;
+
+bool Utf8_narrow::should_do_narrowing(const THD *thd,
+ CHARSET_INFO *field_cset,
+ CHARSET_INFO *value_cset)
+{
+ return optimizer_flag(thd, OPTIMIZER_SWITCH_CSET_NARROWING) &&
+ field_cset == &my_charset_utf8mb3_general_ci &&
+ value_cset == &my_charset_utf8mb4_general_ci;
+}
+