/
usr
/
include
/
mysql
/
server
/
private
/
/usr/include/mysql/server/private
mkdir
upload
Name
Size
Mode
Actions
atomic/
-
0755
rm
data/
-
0755
rm
providers/
-
0755
rm
aligned.h
1136
0644
edit
dl
rm
aria_backup.h
1787
0644
edit
dl
rm
assume_aligned.h
2350
0644
edit
dl
rm
authors.h
10194
0644
edit
dl
rm
backup.h
1703
0644
edit
dl
rm
bounded_queue.h
6093
0644
edit
dl
rm
client_settings.h
1935
0644
edit
dl
rm
compat56.h
2280
0644
edit
dl
rm
config.h
14351
0644
edit
dl
rm
contributors.h
4931
0644
edit
dl
rm
create_options.h
4193
0644
edit
dl
rm
create_tmp_table.h
2808
0644
edit
dl
rm
cset_narrowing.h
3968
0644
edit
dl
rm
custom_conf.h
1082
0644
edit
dl
rm
datadict.h
1700
0644
edit
dl
rm
ddl_log.h
12807
0644
edit
dl
rm
debug.h
1234
0644
edit
dl
rm
debug_sync.h
2046
0644
edit
dl
rm
derived_handler.h
2379
0644
edit
dl
rm
derror.h
980
0644
edit
dl
rm
des_key_file.h
1236
0644
edit
dl
rm
discover.h
1570
0644
edit
dl
rm
dur_prop.h
1082
0644
edit
dl
rm
embedded_priv.h
1733
0644
edit
dl
rm
events.h
4704
0644
edit
dl
rm
event_data_objects.h
4187
0644
edit
dl
rm
event_db_repository.h
3648
0644
edit
dl
rm
event_parse_data.h
2899
0644
edit
dl
rm
event_queue.h
3438
0644
edit
dl
rm
event_scheduler.h
3290
0644
edit
dl
rm
field.h
222414
0644
edit
dl
rm
field_comp.h
1174
0644
edit
dl
rm
filesort.h
7283
0644
edit
dl
rm
filesort_utils.h
8195
0644
edit
dl
rm
ft_global.h
3113
0644
edit
dl
rm
gcalc_slicescan.h
17330
0644
edit
dl
rm
gcalc_tools.h
11900
0644
edit
dl
rm
grant.h
2758
0644
edit
dl
rm
group_by_handler.h
3534
0644
edit
dl
rm
gstream.h
2437
0644
edit
dl
rm
handler.h
199857
0644
edit
dl
rm
handle_connections_win.h
884
0644
edit
dl
rm
hash.h
4452
0644
edit
dl
rm
hash_filo.h
5599
0644
edit
dl
rm
ha_handler_stats.h
2335
0644
edit
dl
rm
ha_partition.h
64696
0644
edit
dl
rm
ha_sequence.h
6245
0644
edit
dl
rm
heap.h
9487
0644
edit
dl
rm
hostname.h
5419
0644
edit
dl
rm
ilist.h
7237
0644
edit
dl
rm
init.h
852
0644
edit
dl
rm
innodb_priv.h
1319
0644
edit
dl
rm
item.h
285458
0644
edit
dl
rm
item_cmpfunc.h
135218
0644
edit
dl
rm
item_create.h
11508
0644
edit
dl
rm
item_func.h
138683
0644
edit
dl
rm
item_geofunc.h
39612
0644
edit
dl
rm
item_jsonfunc.h
25429
0644
edit
dl
rm
item_row.h
5229
0644
edit
dl
rm
item_strfunc.h
75265
0644
edit
dl
rm
item_subselect.h
59087
0644
edit
dl
rm
item_sum.h
72695
0644
edit
dl
rm
item_timefunc.h
65896
0644
edit
dl
rm
item_vers.h
4413
0644
edit
dl
rm
item_windowfunc.h
35089
0644
edit
dl
rm
item_xmlfunc.h
4650
0644
edit
dl
rm
json_table.h
9667
0644
edit
dl
rm
key.h
2132
0644
edit
dl
rm
keycaches.h
1995
0644
edit
dl
rm
lex.h
29840
0644
edit
dl
rm
lex_charset.h
24313
0644
edit
dl
rm
lex_hash.h
143108
0644
edit
dl
rm
lex_ident.h
2122
0644
edit
dl
rm
lex_string.h
4077
0644
edit
dl
rm
lex_symbol.h
1323
0644
edit
dl
rm
lex_token.h
42641
0644
edit
dl
rm
lf.h
6462
0644
edit
dl
rm
lock.h
2220
0644
edit
dl
rm
log.h
46462
0644
edit
dl
rm
log_event.h
189467
0644
edit
dl
rm
log_event_data_type.h
1890
0644
edit
dl
rm
log_event_old.h
19830
0644
edit
dl
rm
log_slow.h
2442
0644
edit
dl
rm
maria.h
5872
0644
edit
dl
rm
mariadb.h
1277
0644
edit
dl
rm
mdl.h
38893
0644
edit
dl
rm
mem_root_array.h
7106
0644
edit
dl
rm
message.h
1195
0644
edit
dl
rm
multi_range_read.h
23179
0644
edit
dl
rm
myisam.h
17506
0644
edit
dl
rm
myisamchk.h
4734
0644
edit
dl
rm
myisammrg.h
4897
0644
edit
dl
rm
myisampack.h
14929
0644
edit
dl
rm
mysqld.h
41225
0644
edit
dl
rm
mysqld_default_groups.h
204
0644
edit
dl
rm
mysqld_suffix.h
1201
0644
edit
dl
rm
mysys_err.h
3022
0644
edit
dl
rm
my_alarm.h
2429
0644
edit
dl
rm
my_apc.h
4747
0644
edit
dl
rm
my_atomic.h
7281
0644
edit
dl
rm
my_atomic_wrapper.h
3051
0644
edit
dl
rm
my_base.h
27750
0644
edit
dl
rm
my_bit.h
6196
0644
edit
dl
rm
my_bitmap.h
5502
0644
edit
dl
rm
my_check_opt.h
2618
0644
edit
dl
rm
my_compare.h
11194
0644
edit
dl
rm
my_counter.h
1721
0644
edit
dl
rm
my_cpu.h
4885
0644
edit
dl
rm
my_crypt.h
904
0644
edit
dl
rm
my_decimal.h
14504
0644
edit
dl
rm
my_default.h
1880
0644
edit
dl
rm
my_handler_errors.h
4882
0644
edit
dl
rm
my_json_writer.h
18706
0644
edit
dl
rm
my_libwrap.h
1183
0644
edit
dl
rm
my_md5.h
1486
0644
edit
dl
rm
my_minidump.h
848
0644
edit
dl
rm
my_nosys.h
1438
0644
edit
dl
rm
my_rdtsc.h
10119
0644
edit
dl
rm
my_rnd.h
1014
0644
edit
dl
rm
my_service_manager.h
2087
0644
edit
dl
rm
my_stacktrace.h
3215
0644
edit
dl
rm
my_stack_alloc.h
6493
0644
edit
dl
rm
my_time.h
10414
0644
edit
dl
rm
my_tree.h
3991
0644
edit
dl
rm
my_uctype.h
69528
0644
edit
dl
rm
my_user.h
1126
0644
edit
dl
rm
my_virtual_mem.h
1255
0644
edit
dl
rm
opt_histogram_json.h
4638
0644
edit
dl
rm
opt_range.h
65903
0644
edit
dl
rm
opt_subselect.h
14545
0644
edit
dl
rm
opt_trace.h
9505
0644
edit
dl
rm
opt_trace_context.h
3291
0644
edit
dl
rm
parse_file.h
4424
0644
edit
dl
rm
partition_element.h
5428
0644
edit
dl
rm
partition_info.h
19864
0644
edit
dl
rm
password.h
1621
0644
edit
dl
rm
pfs_file_provider.h
3153
0644
edit
dl
rm
pfs_idle_provider.h
1385
0644
edit
dl
rm
pfs_memory_provider.h
1626
0644
edit
dl
rm
pfs_metadata_provider.h
1898
0644
edit
dl
rm
pfs_socket_provider.h
2258
0644
edit
dl
rm
pfs_stage_provider.h
1556
0644
edit
dl
rm
pfs_statement_provider.h
4347
0644
edit
dl
rm
pfs_table_provider.h
2625
0644
edit
dl
rm
pfs_thread_provider.h
5560
0644
edit
dl
rm
pfs_transaction_provider.h
2846
0644
edit
dl
rm
privilege.h
28853
0644
edit
dl
rm
probes_mysql.h
973
0644
edit
dl
rm
probes_mysql_nodtrace.h
6087
0644
edit
dl
rm
procedure.h
6819
0644
edit
dl
rm
protocol.h
12537
0644
edit
dl
rm
proxy_protocol.h
548
0644
edit
dl
rm
queues.h
3477
0644
edit
dl
rm
records.h
3147
0644
edit
dl
rm
replication.h
16130
0644
edit
dl
rm
repl_failsafe.h
1585
0644
edit
dl
rm
rijndael.h
1711
0644
edit
dl
rm
rowid_filter.h
15474
0644
edit
dl
rm
rpl_constants.h
3357
0644
edit
dl
rm
rpl_filter.h
4774
0644
edit
dl
rm
rpl_gtid.h
29985
0644
edit
dl
rm
rpl_injector.h
9621
0644
edit
dl
rm
rpl_mi.h
16636
0644
edit
dl
rm
rpl_parallel.h
18228
0644
edit
dl
rm
rpl_record.h
1585
0644
edit
dl
rm
rpl_record_old.h
1407
0644
edit
dl
rm
rpl_reporting.h
3713
0644
edit
dl
rm
rpl_rli.h
36070
0644
edit
dl
rm
rpl_tblmap.h
3177
0644
edit
dl
rm
rpl_utility.h
9800
0644
edit
dl
rm
scheduler.h
3199
0644
edit
dl
rm
scope.h
4393
0644
edit
dl
rm
select_handler.h
2228
0644
edit
dl
rm
semisync.h
2287
0644
edit
dl
rm
semisync_master.h
25764
0644
edit
dl
rm
semisync_master_ack_receiver.h
8709
0644
edit
dl
rm
semisync_slave.h
3736
0644
edit
dl
rm
service_versions.h
2285
0644
edit
dl
rm
session_tracker.h
14275
0644
edit
dl
rm
set_var.h
17331
0644
edit
dl
rm
slave.h
12392
0644
edit
dl
rm
socketpair.h
842
0644
edit
dl
rm
source_revision.h
67
0644
edit
dl
rm
sp.h
22588
0644
edit
dl
rm
span.h
3931
0644
edit
dl
rm
spatial.h
22698
0644
edit
dl
rm
sp_cache.h
2037
0644
edit
dl
rm
sp_head.h
64917
0644
edit
dl
rm
sp_pcontext.h
25427
0644
edit
dl
rm
sp_rcontext.h
14441
0644
edit
dl
rm
sql_acl.h
14167
0644
edit
dl
rm
sql_admin.h
2915
0644
edit
dl
rm
sql_alloc.h
1732
0644
edit
dl
rm
sql_alter.h
15395
0644
edit
dl
rm
sql_analyse.h
11052
0644
edit
dl
rm
sql_analyze_stmt.h
12683
0644
edit
dl
rm
sql_array.h
6858
0644
edit
dl
rm
sql_audit.h
14162
0644
edit
dl
rm
sql_base.h
26050
0644
edit
dl
rm
sql_basic_types.h
9523
0644
edit
dl
rm
sql_binlog.h
895
0644
edit
dl
rm
sql_bitmap.h
7842
0644
edit
dl
rm
sql_bootstrap.h
1812
0644
edit
dl
rm
sql_cache.h
21676
0644
edit
dl
rm
sql_callback.h
1542
0644
edit
dl
rm
sql_class.h
271836
0644
edit
dl
rm
sql_cmd.h
5962
0644
edit
dl
rm
sql_command.h
4800
0644
edit
dl
rm
sql_connect.h
4087
0644
edit
dl
rm
sql_const.h
11630
0644
edit
dl
rm
sql_crypt.h
1437
0644
edit
dl
rm
sql_cte.h
16494
0644
edit
dl
rm
sql_cursor.h
4428
0644
edit
dl
rm
sql_db.h
2438
0644
edit
dl
rm
sql_debug.h
5727
0644
edit
dl
rm
sql_delete.h
1343
0644
edit
dl
rm
sql_derived.h
1289
0644
edit
dl
rm
sql_digest.h
3819
0644
edit
dl
rm
sql_digest_stream.h
1567
0644
edit
dl
rm
sql_do.h
954
0644
edit
dl
rm
sql_error.h
39843
0644
edit
dl
rm
sql_explain.h
30319
0644
edit
dl
rm
sql_expression_cache.h
4359
0644
edit
dl
rm
sql_get_diagnostics.h
7883
0644
edit
dl
rm
sql_handler.h
2910
0644
edit
dl
rm
sql_help.h
995
0644
edit
dl
rm
sql_hset.h
3401
0644
edit
dl
rm
sql_insert.h
5173
0644
edit
dl
rm
sql_i_s.h
8487
0644
edit
dl
rm
sql_join_cache.h
48659
0644
edit
dl
rm
sql_lex.h
174931
0644
edit
dl
rm
sql_lifo_buffer.h
9685
0644
edit
dl
rm
sql_limit.h
3187
0644
edit
dl
rm
sql_list.h
22391
0644
edit
dl
rm
sql_load.h
1276
0644
edit
dl
rm
sql_locale.h
2701
0644
edit
dl
rm
sql_manager.h
960
0644
edit
dl
rm
sql_mode.h
6735
0644
edit
dl
rm
sql_parse.h
8970
0644
edit
dl
rm
sql_partition.h
12674
0644
edit
dl
rm
sql_partition_admin.h
5940
0644
edit
dl
rm
sql_plist.h
7711
0644
edit
dl
rm
sql_plugin.h
7577
0644
edit
dl
rm
sql_plugin_compat.h
2237
0644
edit
dl
rm
sql_prepare.h
11409
0644
edit
dl
rm
sql_priv.h
18528
0644
edit
dl
rm
sql_profile.h
7816
0644
edit
dl
rm
sql_reload.h
1036
0644
edit
dl
rm
sql_rename.h
982
0644
edit
dl
rm
sql_repl.h
3045
0644
edit
dl
rm
sql_schema.h
3303
0644
edit
dl
rm
sql_select.h
89743
0644
edit
dl
rm
sql_sequence.h
5177
0644
edit
dl
rm
sql_servers.h
1777
0644
edit
dl
rm
sql_show.h
9819
0644
edit
dl
rm
sql_signal.h
3362
0644
edit
dl
rm
sql_sort.h
21964
0644
edit
dl
rm
sql_statistics.h
16504
0644
edit
dl
rm
sql_string.h
39009
0644
edit
dl
rm
sql_table.h
9812
0644
edit
dl
rm
sql_test.h
2665
0644
edit
dl
rm
sql_time.h
8505
0644
edit
dl
rm
sql_trigger.h
12332
0644
edit
dl
rm
sql_truncate.h
2079
0644
edit
dl
rm
sql_tvc.h
2418
0644
edit
dl
rm
sql_type.h
297272
0644
edit
dl
rm
sql_type_fixedbin.h
65578
0644
edit
dl
rm
sql_type_fixedbin_storage.h
5467
0644
edit
dl
rm
sql_type_geom.h
19039
0644
edit
dl
rm
sql_type_int.h
10001
0644
edit
dl
rm
sql_type_json.h
6155
0644
edit
dl
rm
sql_type_real.h
1257
0644
edit
dl
rm
sql_type_string.h
1629
0644
edit
dl
rm
sql_udf.h
4850
0644
edit
dl
rm
sql_union.h
1068
0644
edit
dl
rm
sql_update.h
1923
0644
edit
dl
rm
sql_view.h
2470
0644
edit
dl
rm
sql_window.h
6814
0644
edit
dl
rm
ssl_compat.h
3380
0644
edit
dl
rm
strfunc.h
2549
0644
edit
dl
rm
structs.h
29457
0644
edit
dl
rm
sys_vars_shared.h
2729
0644
edit
dl
rm
table.h
119009
0644
edit
dl
rm
table_cache.h
4232
0644
edit
dl
rm
threadpool.h
4810
0644
edit
dl
rm
threadpool_generic.h
3969
0644
edit
dl
rm
threadpool_winsockets.h
2290
0644
edit
dl
rm
thread_cache.h
5905
0644
edit
dl
rm
thr_alarm.h
2932
0644
edit
dl
rm
thr_lock.h
7350
0644
edit
dl
rm
thr_malloc.h
1202
0644
edit
dl
rm
thr_timer.h
1563
0644
edit
dl
rm
transaction.h
1466
0644
edit
dl
rm
tzfile.h
5014
0644
edit
dl
rm
tztime.h
3397
0644
edit
dl
rm
t_ctype.h
5639
0644
edit
dl
rm
uniques.h
4217
0644
edit
dl
rm
unireg.h
7722
0644
edit
dl
rm
vers_string.h
2543
0644
edit
dl
rm
violite.h
9956
0644
edit
dl
rm
waiting_threads.h
4532
0644
edit
dl
rm
welcome_copyright_notice.h
1218
0644
edit
dl
rm
winservice.h
6019
0644
edit
dl
rm
win_tzname_data.h
6506
0644
edit
dl
rm
wqueue.h
1565
0644
edit
dl
rm
wsrep.h
3308
0644
edit
dl
rm
wsrep_allowlist_service.h
1035
0644
edit
dl
rm
wsrep_applier.h
2703
0644
edit
dl
rm
wsrep_binlog.h
3551
0644
edit
dl
rm
wsrep_client_service.h
2602
0644
edit
dl
rm
wsrep_client_state.h
1566
0644
edit
dl
rm
wsrep_condition_variable.h
1484
0644
edit
dl
rm
wsrep_high_priority_service.h
4912
0644
edit
dl
rm
wsrep_mutex.h
1239
0644
edit
dl
rm
wsrep_mysqld.h
22006
0644
edit
dl
rm
wsrep_mysqld_c.h
1227
0644
edit
dl
rm
wsrep_on.h
1718
0644
edit
dl
rm
wsrep_priv.h
1634
0644
edit
dl
rm
wsrep_schema.h
5886
0644
edit
dl
rm
wsrep_server_service.h
3631
0644
edit
dl
rm
wsrep_server_state.h
2529
0644
edit
dl
rm
wsrep_sst.h
3951
0644
edit
dl
rm
wsrep_status.h
1816
0644
edit
dl
rm
wsrep_storage_service.h
1809
0644
edit
dl
rm
wsrep_thd.h
11487
0644
edit
dl
rm
wsrep_trans_observer.h
18174
0644
edit
dl
rm
wsrep_types.h
1110
0644
edit
dl
rm
wsrep_utils.h
10251
0644
edit
dl
rm
wsrep_var.h
4612
0644
edit
dl
rm
wsrep_xid.h
1509
0644
edit
dl
rm
xa.h
1845
0644
edit
dl
rm
Edit:
/usr/include/mysql/server/private/lex_charset.h
(24313B)
/* Copyright (c) 2021, 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 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 St, Fifth Floor, Boston, MA 02110-1335 USA */ #ifndef LEX_CHARSET_INCLUDED #define LEX_CHARSET_INCLUDED /* An extention for Charset_loader_mysys, with server error and warning support. */ class Charset_loader_server: public Charset_loader_mysys { public: using Charset_loader_mysys::Charset_loader_mysys; void raise_unknown_collation_error(const char *name) const; void raise_not_applicable_error(const char *cs, const char *cl) const; /* Find an exact collation by name. Raise an error on a faulure. @param cs - the character set @param collation_name - the collation name, e.g. "utf8_bin" @param my_flags - my flags, e.g. MYF(WME) @returns - a NULL pointer in case of failure, or a CHARSET_INFO pointer on success. */ CHARSET_INFO * get_exact_collation_or_error(const char *name, myf my_flags= MYF(0)) { CHARSET_INFO *ci= get_exact_collation(name, my_flags); if (!ci) raise_unknown_collation_error(name); return ci; } /* Find an exact collation by a character set and a contextually typed collation name. Raise an error on in case of a faulure. @param cs - the character set @param context_cl_name - the context name, e.g. "uca1400_cs_ci" @param my_flags - my flags, e.g. MYF(WME) @returns - a NULL pointer in case of failure, or a CHARSET_INFO pointer on success. */ CHARSET_INFO * get_exact_collation_by_context_name_or_error(CHARSET_INFO *cs, const char *name, myf my_flags= MYF(0)) { CHARSET_INFO *ci= get_exact_collation_by_context_name(cs, name, my_flags); if (!ci) raise_not_applicable_error(cs->cs_name.str, name); return ci; } /* Find an abstract context collation by name. Raise an error on a faulure. The returned pointer needs to be resolved to a character set name. It should not be passed directly to the character set routines. @param cs - the character set @param context_cl_name - the context name, e.g. "uca1400_cs_ci" @param my_flags - my flags, e.g. MYF(WME) @returns - a NULL pointer in case of failure, or a CHARSET_INFO pointer on success. */ CHARSET_INFO * get_context_collation_or_error(const char *collation_name, myf my_flags= MYF(0)) { CHARSET_INFO *ci= get_context_collation(collation_name, my_flags); if (!ci) raise_unknown_collation_error(collation_name); return ci; } /* Find an exact binary collation in the given character set. Raise an error on a faulure. @param cs - the character set @param my_flags - my flags, e.g. MYF(WME) @returns - a NULL pointer in case of failure, or a CHARSET_INFO pointer on success. */ CHARSET_INFO * get_bin_collation_or_error(CHARSET_INFO *cs, myf my_flags= MYF(0)) { const char *cs_name= cs->cs_name.str; if (!(cs= get_bin_collation(cs, my_flags))) { char tmp[65]; strxnmov(tmp, sizeof(tmp)-1, cs_name, "_bin", NULL); raise_unknown_collation_error(tmp); } return cs; } /* Find an exact default collation in the given character set. This routine does not fail. Any character set must have a default collation. @param cs - the character set @param my_flags - my flags, e.g. MYF(WME) @returns - a CHARSET_INFO pointer */ CHARSET_INFO *get_default_collation(CHARSET_INFO *cs, myf my_flags= MYF(0)) { return Charset_loader_mysys::get_default_collation(cs, my_flags); } }; ///////////////////////////////////////////////////////////////////// /* An exact character set, e.g: CHARACTER SET latin1 */ class Lex_exact_charset { CHARSET_INFO *m_ci; public: explicit Lex_exact_charset(CHARSET_INFO *ci) :m_ci(ci) { DBUG_ASSERT(m_ci); DBUG_ASSERT(m_ci->state & MY_CS_PRIMARY); } CHARSET_INFO *charset_info() const { return m_ci; } bool raise_if_not_equal(const Lex_exact_charset &rhs) const; bool raise_if_not_applicable(const class Lex_exact_collation &cl) const; }; /* An optional contextually typed character set: [ CHARACTER SET DEFAULT ] */ class Lex_opt_context_charset_st { /* Currently we support only DEFAULT as a possible value. So "bool" is enough. */ bool m_had_charset_default; public: void init() { m_had_charset_default= false; } void merge_charset_default() { /* Ok to specify CHARACTER SET DEFAULT multiple times. No error raised here. */ m_had_charset_default= true; } bool is_empty() const { return !m_had_charset_default; } bool is_contextually_typed_charset_default() const { return m_had_charset_default; } }; /* A contextually typed collation, e.g.: COLLATE DEFAULT CHAR(10) BINARY */ class Lex_context_collation { CHARSET_INFO *m_ci; public: explicit Lex_context_collation(CHARSET_INFO *ci) :m_ci(ci) { DBUG_ASSERT(ci); } CHARSET_INFO *charset_info() const { return m_ci; } bool is_contextually_typed_collate_default() const { return m_ci == &my_collation_contextually_typed_default; } bool is_contextually_typed_binary_style() const { return m_ci == &my_collation_contextually_typed_binary; } bool raise_if_not_equal(const Lex_context_collation &cl) const; /* Skip the character set prefix, return the suffix. utf8mb4_uca1400_as_ci -> uca1400_as_ci */ LEX_CSTRING collation_name_context_suffix() const { return m_ci->get_collation_name(MY_COLLATION_NAME_MODE_CONTEXT); } LEX_CSTRING collation_name_for_show() const; }; /* An exact collation, e.g. COLLATE latin1_swedish_ci */ class Lex_exact_collation { CHARSET_INFO *m_ci; public: explicit Lex_exact_collation(CHARSET_INFO *ci) :m_ci(ci) { DBUG_ASSERT(ci); } CHARSET_INFO *charset_info() const { return m_ci; } // EXACT + EXACT bool raise_if_not_equal(const Lex_exact_collation &cl) const; // EXACT + CONTEXT // CONTEXT + EXACT bool raise_if_conflicts_with_context_collation(const Lex_context_collation &, bool reverse_order) const; }; /* Parse time COLLATE clause: COLLATE colation_name The collation can be either exact or contextual: COLLATE latin1_bin COLLATE DEFAULT */ class Lex_extended_collation_st { public: enum Type { TYPE_EXACT, TYPE_CONTEXTUALLY_TYPED }; protected: CHARSET_INFO *m_ci; Type m_type; public: void init(CHARSET_INFO *ci, Type type) { m_ci= ci; m_type= type; } CHARSET_INFO *charset_info() const { return m_ci; } Type type() const { return m_type; } LEX_CSTRING collation_name_for_show() const { switch (m_type) { case TYPE_CONTEXTUALLY_TYPED: return Lex_context_collation(m_ci).collation_name_for_show(); case TYPE_EXACT: return m_ci->coll_name; } DBUG_ASSERT(0); return m_ci->coll_name; } static Lex_extended_collation_st collate_default() { Lex_extended_collation_st res; res.set_collate_default(); return res; } void set_collate_default() { m_ci= &my_collation_contextually_typed_default; m_type= TYPE_CONTEXTUALLY_TYPED; } bool set_by_name(const char *name, myf my_flags); // e.g. MY_UTF8_IS_UTF8MB3 bool raise_if_conflicts_with_context_collation(const Lex_context_collation &) const; bool merge_exact_charset(const Lex_exact_charset &rhs); bool merge_exact_collation(const Lex_exact_collation &rhs); bool merge(const Lex_extended_collation_st &rhs); }; class Lex_extended_collation: public Lex_extended_collation_st { public: Lex_extended_collation(CHARSET_INFO *ci, Type type) { init(ci, type); } Lex_extended_collation(const Lex_exact_collation &rhs) { init(rhs.charset_info(), TYPE_EXACT); } Lex_extended_collation(const Lex_context_collation &rhs) { init(rhs.charset_info(), TYPE_CONTEXTUALLY_TYPED); } }; /* CHARACTER SET cs_exact [COLLATE cl_exact_or_context] */ class Lex_exact_charset_opt_extended_collate { CHARSET_INFO *m_ci; bool m_with_collate; public: Lex_exact_charset_opt_extended_collate(CHARSET_INFO *ci, bool with_collate) :m_ci(ci), m_with_collate(with_collate) { DBUG_ASSERT(m_ci); DBUG_ASSERT((m_ci->state & MY_CS_PRIMARY) || m_with_collate); } Lex_exact_charset_opt_extended_collate(const Lex_exact_charset &cs) :m_ci(cs.charset_info()), m_with_collate(false) { DBUG_ASSERT(m_ci); DBUG_ASSERT(m_ci->state & MY_CS_PRIMARY); } Lex_exact_charset_opt_extended_collate(const Lex_exact_collation &cl) :m_ci(cl.charset_info()), m_with_collate(true) { DBUG_ASSERT(m_ci); } bool with_collate() const { return m_with_collate; } CHARSET_INFO *find_bin_collation() const; CHARSET_INFO *find_default_collation() const; bool raise_if_charsets_differ(const Lex_exact_charset &cs) const; bool raise_if_not_applicable(const Lex_exact_collation &cl) const; /* Add another COLLATE clause (exact or context). So the full syntax looks like: CHARACTER SET cs [COLLATE cl] ... COLLATE cl2 */ bool merge_collation(const Lex_extended_collation_st &cl) { switch (cl.type()) { case Lex_extended_collation_st::TYPE_EXACT: return merge_exact_collation(Lex_exact_collation(cl.charset_info())); case Lex_extended_collation_st::TYPE_CONTEXTUALLY_TYPED: return merge_context_collation(Lex_context_collation(cl.charset_info())); } DBUG_ASSERT(0); return false; } bool merge_collation_override(const Lex_extended_collation_st &cl) { switch (cl.type()) { case Lex_extended_collation_st::TYPE_EXACT: return merge_exact_collation_override( Lex_exact_collation(cl.charset_info())); case Lex_extended_collation_st::TYPE_CONTEXTUALLY_TYPED: return merge_context_collation_override( Lex_context_collation(cl.charset_info())); } DBUG_ASSERT(0); return false; } /* Add a context collation: CHARACTER SET cs [COLLATE cl] ... COLLATE DEFAULT */ bool merge_context_collation(const Lex_context_collation &cl); bool merge_context_collation_override(const Lex_context_collation &cl); /* Add an exact collation: CHARACTER SET cs [COLLATE cl] ... COLLATE latin1_bin */ bool merge_exact_collation(const Lex_exact_collation &cl); bool merge_exact_collation_override(const Lex_exact_collation &cl); Lex_exact_collation collation() const { return Lex_exact_collation(m_ci); } Lex_exact_charset charset() const { if ((m_ci->state & MY_CS_PRIMARY)) return Lex_exact_charset(m_ci); return Lex_exact_charset(find_default_collation()); } }; /* Parse time character set and collation for: [CHARACTER SET cs_exact] [COLLATE cl_exact_or_context] Can be: 1. Empty (not specified on the column level): CREATE TABLE t1 (a CHAR(10)) CHARACTER SET latin2; -- (1a) CREATE TABLE t1 (a CHAR(10)); -- (1b) 2. Precisely typed: CREATE TABLE t1 (a CHAR(10) COLLATE latin1_bin); -- (2a) CREATE TABLE t1 ( a CHAR(10) CHARACTER SET latin1 COLLATE latin1_bin); -- (2b) 3. Contextually typed: CREATE TABLE t2 (a CHAR(10) BINARY) CHARACTER SET latin2; -- (3a) CREATE TABLE t2 (a CHAR(10) BINARY); -- (3b) CREATE TABLE t2 (a CHAR(10) COLLATE DEFAULT) CHARACER SET latin2 COLLATE latin2_bin; -- (3c) In case of an empty or a contextually typed collation, it is a subject to later resolution, when the context character set becomes known in the end of the CREATE statement: - either after the explicit table level CHARACTER SET, like in (1a,3a,3c) - or by the inhereted database level CHARACTER SET, like in (1b,3b) Resolution happens in Type_handler::Column_definition_prepare_stage1(). */ struct Lex_exact_charset_extended_collation_attrs_st { public: enum Type { TYPE_EMPTY= 0, TYPE_CHARACTER_SET= 1, TYPE_COLLATE_EXACT= 2, TYPE_CHARACTER_SET_COLLATE_EXACT= 3, TYPE_COLLATE_CONTEXTUALLY_TYPED= 4 }; // Number of bits required to store enum Type values #define LEX_CHARSET_COLLATION_TYPE_BITS 3 #define LEX_CHARSET_COLLATION_TYPE_MASK ((1<<LEX_CHARSET_COLLATION_TYPE_BITS)-1) static_assert(LEX_CHARSET_COLLATION_TYPE_MASK >= TYPE_COLLATE_CONTEXTUALLY_TYPED, "Lex_exact_charset_extended_collation_attrs_st::Type bits"); protected: CHARSET_INFO *m_ci; Type m_type; protected: static Type type_from_lex_collation_type(Lex_extended_collation_st::Type type) { switch (type) { case Lex_extended_collation_st::TYPE_EXACT: return TYPE_COLLATE_EXACT; case Lex_extended_collation_st::TYPE_CONTEXTUALLY_TYPED: return TYPE_COLLATE_CONTEXTUALLY_TYPED; } DBUG_ASSERT(0); return TYPE_COLLATE_EXACT; } public: void init() { m_ci= NULL; m_type= TYPE_EMPTY; } void init(CHARSET_INFO *cs, Type type) { DBUG_ASSERT(cs || type == TYPE_EMPTY); m_ci= cs; m_type= type; } void init(const Lex_exact_charset &cs) { m_ci= cs.charset_info(); m_type= TYPE_CHARACTER_SET; } void init(const Lex_exact_collation &cs) { m_ci= cs.charset_info(); m_type= TYPE_COLLATE_EXACT; } void init(const Lex_exact_charset_opt_extended_collate &cscl) { if (cscl.with_collate()) init(cscl.collation().charset_info(), TYPE_CHARACTER_SET_COLLATE_EXACT); else init(cscl.charset()); } bool is_empty() const { return m_type == TYPE_EMPTY; } void set_charset(const Lex_exact_charset &cs) { m_ci= cs.charset_info(); m_type= TYPE_CHARACTER_SET; } bool set_charset_collate_default(const Lex_exact_charset &cs) { CHARSET_INFO *ci; if (!(ci= Lex_exact_charset_opt_extended_collate(cs). find_default_collation())) return true; m_ci= ci; m_type= TYPE_CHARACTER_SET_COLLATE_EXACT; return false; } bool set_charset_collate_binary(const Lex_exact_charset &cs) { CHARSET_INFO *ci; if (!(ci= Lex_exact_charset_opt_extended_collate(cs).find_bin_collation())) return true; m_ci= ci; m_type= TYPE_CHARACTER_SET_COLLATE_EXACT; return false; } void set_collate_default() { m_ci= &my_collation_contextually_typed_default; m_type= TYPE_COLLATE_CONTEXTUALLY_TYPED; } void set_contextually_typed_binary_style() { m_ci= &my_collation_contextually_typed_binary; m_type= TYPE_COLLATE_CONTEXTUALLY_TYPED; } bool is_contextually_typed_collate_default() const { return Lex_context_collation(m_ci).is_contextually_typed_collate_default(); } CHARSET_INFO *charset_info() const { return m_ci; } Type type() const { return m_type; } bool is_contextually_typed_collation() const { return m_type == TYPE_COLLATE_CONTEXTUALLY_TYPED; } CHARSET_INFO *resolved_to_character_set(CHARSET_INFO *cs) const; /* Merge the column CHARACTER SET clause to: - an exact collation name - a contextually typed collation "this" corresponds to `CHARACTER SET xxx [BINARY]` "cl" corresponds to the COLLATE clause */ bool merge_column_charset_clause_and_collate_clause( const Lex_exact_charset_extended_collation_attrs_st &cl) { switch (cl.type()) { case TYPE_EMPTY: return false; case TYPE_COLLATE_EXACT: return merge_exact_collation(Lex_exact_collation(cl.charset_info())); case TYPE_COLLATE_CONTEXTUALLY_TYPED: return merge_context_collation(Lex_context_collation(cl.charset_info())); case TYPE_CHARACTER_SET: case TYPE_CHARACTER_SET_COLLATE_EXACT: break; } DBUG_ASSERT(0); return false; } /* This method is used in the "attribute_list" rule to merge two independent COLLATE clauses (not belonging to a CHARACTER SET clause). "BINARY" and "COLLATE DEFAULT" are not possible in an independent COLLATE clause in a column attribute. */ bool merge_column_collate_clause_and_collate_clause( const Lex_exact_charset_extended_collation_attrs_st &cl) { DBUG_ASSERT(m_type != TYPE_CHARACTER_SET); switch (cl.type()) { case TYPE_EMPTY: return false; case TYPE_COLLATE_EXACT: return merge_exact_collation(Lex_exact_collation(cl.charset_info())); case TYPE_COLLATE_CONTEXTUALLY_TYPED: return merge_context_collation(Lex_context_collation(cl.charset_info())); case TYPE_CHARACTER_SET: case TYPE_CHARACTER_SET_COLLATE_EXACT: break; } DBUG_ASSERT(0); return false; } bool merge_exact_charset(const Lex_exact_charset &cs); bool merge_exact_collation(const Lex_exact_collation &cl); bool merge_context_collation(const Lex_context_collation &cl); bool merge_collation(const Lex_extended_collation_st &cl); }; class Charset_collation_context { /* Although the goal of m_charset_default is to store the meaning of CHARACTER SET DEFAULT, it does not necessarily point to a default collation of CHARACTER SET DEFAULT. It can point to its any arbitrary collation. For performance purposes we don't need to find the default collation at the instantiation time of "this", because: - m_charset_default may not be even needed during the resolution - when it's needed, in many cases it's passed to my_charset_same(), which does not need the default collation again. Note, m_charset_default and m_collate_default are not necessarily equal. - The default value for CHARACTER SET is taken from the upper level: CREATE DATABASE db1 CHARACTER SET DEFAULT; <-- @@character_set_server ALTER DATABASE db1 CHARACTER SET DEFAULT; <-- @@character_set_server - The default value for COLLATE is taken from the upper level for CREATE: CREATE DATABASE db1 COLLATE DEFAULT; <-- @@collation_server CREATE TABLE db1.t1 COLLATE DEFAULT; <-- character set of "db1" - The default value for COLLATE is taken from the same level for ALTER: ALTER DATABASE db1 COLLATE DEFAULT; <-- the default collation of the current db1 character set ALTER TABLE db1.t1 COLLATE DEFAULT; <-- the default collation of the current db1.t1 character set */ // comes from the upper level Lex_exact_charset_opt_extended_collate m_charset_default; // comes from the upper or the current level Lex_exact_collation m_collate_default; public: Charset_collation_context(CHARSET_INFO *charset_default, CHARSET_INFO *collate_default) :m_charset_default(charset_default, !(charset_default->state & MY_CS_PRIMARY)), m_collate_default(collate_default) { } const Lex_exact_charset_opt_extended_collate charset_default() const { return m_charset_default; } const Lex_exact_collation collate_default() const { return m_collate_default; } }; /* A universal container. It can store at the same time: - CHARACTER SET DEFAULT - CHARACTER SET cs_exact - COLLATE {cl_exact|cl_context} All three parts can co-exist. All three parts are optional. Parts can come in any arbitrary order, e.g: CHARACTER SET DEFAULT [CHARACTER SET latin1] COLLATE latin1_bin CHARACTER SET latin1 CHARACTER SET DEFAULT COLLATE latin1_bin COLLATE latin1_bin [CHARACTER SET latin1] CHARACTER SET DEFAULT COLLATE latin1_bin CHARACTER SET DEFAULT [CHARACTER SET latin1] */ class Lex_extended_charset_extended_collation_attrs_st: public Lex_opt_context_charset_st, public Lex_exact_charset_extended_collation_attrs_st { enum charset_type_t { CHARSET_TYPE_EMPTY, CHARSET_TYPE_CONTEXT, CHARSET_TYPE_EXACT }; /* Which part came first: - CHARACTER SET DEFAULT or - CHARACTER SET cs_exact e.g. to produce error messages preserving the user typed order of CHARACTER SET clauses in case of conflicts. */ charset_type_t m_charset_order; public: void init() { Lex_opt_context_charset_st::init(); Lex_exact_charset_extended_collation_attrs_st::init(); m_charset_order= CHARSET_TYPE_EMPTY; } void init(const Lex_exact_charset_opt_extended_collate &c) { Lex_opt_context_charset_st::init(); Lex_exact_charset_extended_collation_attrs_st::init(c); m_charset_order= CHARSET_TYPE_EXACT; } bool is_empty() const { return Lex_opt_context_charset_st::is_empty() && Lex_exact_charset_extended_collation_attrs_st::is_empty(); } bool raise_if_charset_conflicts_with_default( const Lex_exact_charset_opt_extended_collate &def) const; CHARSET_INFO *resolved_to_context(const Charset_collation_context &ctx) const; bool merge_charset_default(); bool merge_exact_charset(const Lex_exact_charset &cs); }; class Lex_exact_charset_extended_collation_attrs: public Lex_exact_charset_extended_collation_attrs_st { public: Lex_exact_charset_extended_collation_attrs() { init(); } Lex_exact_charset_extended_collation_attrs(CHARSET_INFO *collation, Type type) { init(collation, type); } explicit Lex_exact_charset_extended_collation_attrs(const Lex_exact_charset &cs) { init(cs.charset_info(), TYPE_CHARACTER_SET); } explicit Lex_exact_charset_extended_collation_attrs(const Lex_exact_collation &cl) { init(cl.charset_info(), TYPE_COLLATE_EXACT); } explicit Lex_exact_charset_extended_collation_attrs(const Lex_context_collation &cl) { init(cl.charset_info(), TYPE_COLLATE_CONTEXTUALLY_TYPED); } explicit Lex_exact_charset_extended_collation_attrs( const Lex_exact_charset_opt_extended_collate &cscl) { init(cscl); } explicit Lex_exact_charset_extended_collation_attrs(const Lex_extended_collation_st &cl) { init(cl.charset_info(), type_from_lex_collation_type(cl.type())); } static Lex_exact_charset_extended_collation_attrs national(bool bin_mod) { return bin_mod ? Lex_exact_charset_extended_collation_attrs(&my_charset_utf8mb3_bin, TYPE_COLLATE_EXACT) : Lex_exact_charset_extended_collation_attrs(&my_charset_utf8mb3_general_ci, TYPE_CHARACTER_SET); } }; class Lex_extended_charset_extended_collation_attrs: public Lex_extended_charset_extended_collation_attrs_st { public: Lex_extended_charset_extended_collation_attrs() { init(); } explicit Lex_extended_charset_extended_collation_attrs( const Lex_exact_charset_opt_extended_collate &c) { init(c); } }; using Lex_column_charset_collation_attrs_st = Lex_exact_charset_extended_collation_attrs_st; using Lex_column_charset_collation_attrs = Lex_exact_charset_extended_collation_attrs; using Lex_table_charset_collation_attrs_st = Lex_extended_charset_extended_collation_attrs_st; using Lex_table_charset_collation_attrs = Lex_extended_charset_extended_collation_attrs; #endif // LEX_CHARSET_INCLUDED
Save
cmd:
run