├── .gitignore
├── .gitmodules
├── AMBuildScript
├── AMBuilder
├── LICENSE
├── PackageScript
├── README.md
├── configure.py
├── example
├── AMBuildScript
├── AMBuilder
├── PackageScript
├── README.md
├── configure.py
├── hl2sdk-manifests
├── include
│ └── mysql_mm.h
├── sample_mm.cpp
└── sample_mm.h
├── mysql_mm.sln
├── mysql_mm.vcxproj
├── mysql_mm.vcxproj.filters
├── mysql_mm.vcxproj.user
├── src
├── database.cpp
├── database.h
├── mysql_client.cpp
├── mysql_client.h
├── mysql_mm.cpp
├── mysql_mm.h
├── mysql_result.cpp
├── mysql_result.h
├── network_connection.pb.h
├── operations
│ ├── connect.cpp
│ ├── connect.h
│ ├── query.cpp
│ └── query.h
└── public
│ └── mysql_mm.h
└── vendor
└── mysql
├── include
├── big_endian.h
├── binary_log_types.h
├── byte_order_generic.h
├── byte_order_generic_x86.h
├── decimal.h
├── errmsg.h
├── keycache.h
├── little_endian.h
├── m_ctype.h
├── m_string.h
├── my_alloc.h
├── my_byteorder.h
├── my_command.h
├── my_compiler.h
├── my_config.h
├── my_dbug.h
├── my_dir.h
├── my_getopt.h
├── my_global.h
├── my_list.h
├── my_sys.h
├── my_thread.h
├── my_thread_local.h
├── my_xml.h
├── mysql.h
├── mysql
│ ├── client_authentication.h
│ ├── client_plugin.h
│ ├── client_plugin.h.pp
│ ├── com_data.h
│ ├── get_password.h
│ ├── group_replication_priv.h
│ ├── innodb_priv.h
│ ├── mysql_lex_string.h
│ ├── plugin.h
│ ├── plugin_audit.h
│ ├── plugin_audit.h.pp
│ ├── plugin_auth.h
│ ├── plugin_auth.h.pp
│ ├── plugin_auth_common.h
│ ├── plugin_ftparser.h
│ ├── plugin_ftparser.h.pp
│ ├── plugin_group_replication.h
│ ├── plugin_keyring.h
│ ├── plugin_keyring.h.pp
│ ├── plugin_trace.h
│ ├── plugin_validate_password.h
│ ├── psi
│ │ ├── mysql_file.h
│ │ ├── mysql_idle.h
│ │ ├── mysql_mdl.h
│ │ ├── mysql_memory.h
│ │ ├── mysql_ps.h
│ │ ├── mysql_socket.h
│ │ ├── mysql_sp.h
│ │ ├── mysql_stage.h
│ │ ├── mysql_statement.h
│ │ ├── mysql_table.h
│ │ ├── mysql_thread.h
│ │ ├── mysql_transaction.h
│ │ ├── psi.h
│ │ ├── psi_base.h
│ │ └── psi_memory.h
│ ├── service_command.h
│ ├── service_locking.h
│ ├── service_my_plugin_log.h
│ ├── service_my_snprintf.h
│ ├── service_mysql_alloc.h
│ ├── service_mysql_keyring.h
│ ├── service_mysql_password_policy.h
│ ├── service_mysql_string.h
│ ├── service_parser.h
│ ├── service_rpl_transaction_ctx.h
│ ├── service_rpl_transaction_write_set.h
│ ├── service_rules_table.h
│ ├── service_security_context.h
│ ├── service_srv_session.h
│ ├── service_srv_session_info.h
│ ├── service_ssl_wrapper.h
│ ├── service_thd_alloc.h
│ ├── service_thd_engine_lock.h
│ ├── service_thd_wait.h
│ ├── service_thread_scheduler.h
│ ├── services.h
│ ├── services.h.pp
│ ├── thread_pool_priv.h
│ └── thread_type.h
├── mysql_com.h
├── mysql_com_server.h
├── mysql_embed.h
├── mysql_time.h
├── mysql_version.h
├── mysqld_ername.h
├── mysqld_error.h
├── mysqlx_ername.h
├── mysqlx_error.h
├── mysqlx_version.h
├── plugin.h
├── plugin_audit.h
├── plugin_ftparser.h
├── plugin_group_replication.h
├── plugin_keyring.h
├── plugin_validate_password.h
├── sql_common.h
├── sql_state.h
├── sslopt-case.h
├── sslopt-longopts.h
├── sslopt-vars.h
├── thr_cond.h
├── thr_mutex.h
├── thr_rwlock.h
└── typelib.h
└── lib
└── mysqlclient.lib
/.gitignore:
--------------------------------------------------------------------------------
1 | .vs
2 | build
3 | winbuild
4 | package
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "hl2sdk-manifests"]
2 | path = hl2sdk-manifests
3 | url = https://github.com/alliedmodders/hl2sdk-manifests
4 |
--------------------------------------------------------------------------------
/AMBuilder:
--------------------------------------------------------------------------------
1 | # vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
2 | import os
3 |
4 | # Here only one sdk should be available to generate only one executable in the end,
5 | # as multi-sdk loading isn't supported out of the box by metamod, and would require specifying the full path in the vdf
6 | # which in the end would ruin the multi-platform (unix, win etc) loading by metamod as it won't be able to append platform specific extension
7 | # so just fall back to the single binary.
8 | # Multi-sdk solutions should be manually loaded with a custom plugin loader (examples being sourcemod, stripper:source)
9 | for sdk_target in MMSPlugin.sdk_targets:
10 | sdk = sdk_target.sdk
11 | cxx = sdk_target.cxx
12 |
13 | binary = MMSPlugin.HL2Library(builder, cxx, MMSPlugin.plugin_name, sdk)
14 |
15 | binary.sources += [
16 | 'src/mysql_mm.cpp',
17 | 'src/database.cpp',
18 | 'src/operations/connect.cpp',
19 | 'src/operations/query.cpp',
20 | 'src/mysql_result.cpp',
21 | 'src/mysql_client.cpp',
22 | ]
23 |
24 | if binary.compiler.target.platform == 'linux':
25 | binary.compiler.postlink += [
26 | '/lib/x86_64-linux-gnu/libmysqlclient.a',
27 | '-lz',
28 | '-lpthread',
29 | '-lm',
30 | ]
31 | binary.compiler.postlink += ['-lrt', '-lssl', '-lcrypto']
32 |
33 | if binary.compiler.target.platform == 'windows':
34 | binary.compiler.defines += ['WIN32_LEAN_AND_MEAN']
35 | binary.compiler.cxxincludes += [
36 | os.path.join(builder.sourcePath, 'vendor', 'mysql', 'include'),
37 | ]
38 | binary.compiler.postlink += [
39 | 'crypt32.lib',
40 | os.path.join(builder.sourcePath, 'vendor', 'mysql', 'lib', 'mysqlclient.lib'),
41 | ]
42 |
43 | binary.custom = [builder.tools.Protoc(protoc = sdk_target.protoc, sources = [
44 | os.path.join(sdk['path'], 'common', 'network_connection.proto'),
45 | ])]
46 |
47 | if cxx.target.arch == 'x86':
48 | binary.sources += ['sourcehook/sourcehook_hookmangen.cpp']
49 | nodes = builder.Add(binary)
50 | MMSPlugin.binaries += [nodes]
51 |
--------------------------------------------------------------------------------
/PackageScript:
--------------------------------------------------------------------------------
1 | # vim: set ts=2 sw=2 tw=99 noet ft=python:
2 | import os
3 |
4 | builder.SetBuildFolder('package')
5 |
6 | metamod_folder = builder.AddFolder(os.path.join('addons', 'metamod'))
7 | bin_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin')
8 | bin_folder = builder.AddFolder(bin_folder_path)
9 |
10 | for cxx in MMSPlugin.all_targets:
11 | if cxx.target.arch == 'x86_64':
12 | if cxx.target.platform == 'windows':
13 | bin64_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin', 'win64')
14 | bin64_folder = builder.AddFolder(bin64_folder_path)
15 | elif cxx.target.platform == 'linux':
16 | bin64_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin', 'linuxsteamrt64')
17 | bin64_folder = builder.AddFolder(bin64_folder_path)
18 | elif cxx.target.platform == 'mac':
19 | bin64_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin', 'osx64')
20 | bin64_folder = builder.AddFolder(bin64_folder_path)
21 |
22 | pdb_list = []
23 | for task in MMSPlugin.binaries:
24 | # This hardly assumes there's only 1 targetted platform and would be overwritten
25 | # with whatever comes last if multiple are used!
26 | with open(os.path.join(builder.buildPath, MMSPlugin.plugin_name + '.vdf'), 'w') as fp:
27 | fp.write('"Metamod Plugin"\n')
28 | fp.write('{\n')
29 | fp.write(f'\t"alias"\t"{MMSPlugin.plugin_alias}"\n')
30 | if task.target.arch == 'x86_64':
31 | fp.write(f'\t"file"\t"{os.path.join(bin64_folder_path, MMSPlugin.plugin_name)}"\n')
32 | else:
33 | fp.write(f'\t"file"\t"{os.path.join(bin_folder_path, MMSPlugin.plugin_name)}"\n')
34 | fp.write('}\n')
35 |
36 | if task.target.arch == 'x86_64':
37 | builder.AddCopy(task.binary, bin64_folder)
38 | else:
39 | builder.AddCopy(task.binary, bin_folder)
40 |
41 | if task.debug:
42 | pdb_list.append(task.debug)
43 |
44 | builder.AddCopy(os.path.join(builder.buildPath, MMSPlugin.plugin_name + '.vdf'), metamod_folder)
45 |
46 | # Generate PDB info.
47 | with open(os.path.join(builder.buildPath, 'pdblog.txt'), 'wt') as fp:
48 | for line in pdb_list:
49 | fp.write(line.path + '\n')
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MySQLMM
2 |
3 | MySQLMM is a simple non-blocking MySQL connector for MetaMod.
4 |
5 | # Features
6 |
7 | - Non-blocking MySQL queries
8 | - Windows & Linux support
9 | - Simple API
10 |
11 | # Interface
12 |
13 | MySQLMM will expose an interface in `OnMetamodQuery` which can then be queried with `(IMySQLClient*)g_SMAPI->MetaFactory(MYSQLMM_INTERFACE, &ret, NULL);` by other plugins.
14 | Interface definition can be found in `src/public`.
15 |
16 | ## Compilation
17 |
18 | ### Requirements
19 |
20 | - [Metamod:Source](https://www.sourcemm.net/downloads.php/?branch=master) (build 1219 or higher)
21 | - [AMBuild](https://wiki.alliedmods.net/Ambuild)
22 |
23 | ### Instructions
24 |
25 | Follow the instructions below to compile CS2Fixes.
26 |
27 | ```bash
28 | git clone https://github.com/Poggicek/mysql_mm && cd mysql_mm
29 |
30 | export MMSOURCE112=/path/to/metamod/
31 | export HL2SDKCS2=/path/to/hl2sdk-cs2
32 |
33 | mkdir build && cd build
34 | python3 ../configure.py -s cs2
35 | ambuild
36 | ```
37 |
38 | > [!IMPORTANT]
39 | > Linux build requires `libmysqlclient-dev` package to be installed.
--------------------------------------------------------------------------------
/configure.py:
--------------------------------------------------------------------------------
1 | # vim: set sts=2 ts=8 sw=2 tw=99 et:
2 | import sys
3 | try:
4 | from ambuild2 import run, util
5 | except:
6 | try:
7 | import ambuild
8 | sys.stderr.write('It looks like you have AMBuild 1 installed, but this project uses AMBuild 2.\n')
9 | sys.stderr.write('Upgrade to the latest version of AMBuild to continue.\n')
10 | except:
11 | sys.stderr.write('AMBuild must be installed to build this project.\n')
12 | sys.stderr.write('http://www.alliedmods.net/ambuild\n')
13 | sys.exit(1)
14 |
15 | # Hack to show a decent upgrade message, which wasn't done until 2.2.
16 | ambuild_version = getattr(run, 'CURRENT_API', '2.1')
17 | if ambuild_version.startswith('2.1'):
18 | sys.stderr.write("AMBuild 2.2 or higher is required; please update\n")
19 | sys.exit(1)
20 |
21 | parser = run.BuildParser(sourcePath=sys.path[0], api='2.2')
22 | parser.options.add_argument('-n', '--plugin-name', type=str, dest='plugin_name', default=None,
23 | help='Plugin name')
24 | parser.options.add_argument('-a', '--plugin-alias', type=str, dest='plugin_alias', default=None,
25 | help='Plugin alias')
26 | parser.options.add_argument('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
27 | help='Root search folder for HL2SDKs')
28 | parser.options.add_argument('--hl2sdk-manifests', type=str, dest='hl2sdk_manifests', default=None,
29 | help='HL2SDK manifests source tree folder')
30 | parser.options.add_argument('--mms_path', type=str, dest='mms_path', default=None,
31 | help='Metamod:Source source tree folder')
32 | parser.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug',
33 | help='Enable debugging symbols')
34 | parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt',
35 | help='Enable optimization')
36 | parser.options.add_argument('-s', '--sdks', default='all', dest='sdks',
37 | help='Build against specified SDKs; valid args are "all", "present", or '
38 | 'comma-delimited list of engine names (default: "all")')
39 | parser.options.add_argument('--targets', type=str, dest='targets', default=None,
40 | help="Override the target architecture (use commas to separate multiple targets).")
41 | parser.Configure()
42 |
--------------------------------------------------------------------------------
/example/AMBuilder:
--------------------------------------------------------------------------------
1 | # vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
2 | import os
3 |
4 | # Here only one sdk should be available to generate only one executable in the end,
5 | # as multi-sdk loading isn't supported out of the box by metamod, and would require specifying the full path in the vdf
6 | # which in the end would ruin the multi-platform (unix, win etc) loading by metamod as it won't be able to append platform specific extension
7 | # so just fall back to the single binary.
8 | # Multi-sdk solutions should be manually loaded with a custom plugin loader (examples being sourcemod, stripper:source)
9 | for sdk_target in MMSPlugin.sdk_targets:
10 | sdk = sdk_target.sdk
11 | cxx = sdk_target.cxx
12 |
13 | binary = MMSPlugin.HL2Library(builder, cxx, MMSPlugin.plugin_name, sdk)
14 |
15 | binary.sources += [
16 | 'sample_mm.cpp',
17 | ]
18 |
19 | binary.custom = [builder.tools.Protoc(protoc = sdk_target.protoc, sources = [
20 | os.path.join(sdk['path'], 'common', 'network_connection.proto'),
21 | ])]
22 |
23 | nodes = builder.Add(binary)
24 | MMSPlugin.binaries += [nodes]
25 |
--------------------------------------------------------------------------------
/example/PackageScript:
--------------------------------------------------------------------------------
1 | # vim: set ts=2 sw=2 tw=99 noet ft=python:
2 | import os
3 |
4 | builder.SetBuildFolder('package')
5 |
6 | metamod_folder = builder.AddFolder(os.path.join('addons', 'metamod'))
7 | bin_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin')
8 | bin_folder = builder.AddFolder(bin_folder_path)
9 |
10 | for cxx in MMSPlugin.all_targets:
11 | if cxx.target.arch == 'x86_64':
12 | if cxx.target.platform == 'windows':
13 | bin64_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin', 'win64')
14 | bin64_folder = builder.AddFolder(bin64_folder_path)
15 | elif cxx.target.platform == 'linux':
16 | bin64_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin', 'linuxsteamrt64')
17 | bin64_folder = builder.AddFolder(bin64_folder_path)
18 | elif cxx.target.platform == 'mac':
19 | bin64_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin', 'osx64')
20 | bin64_folder = builder.AddFolder(bin64_folder_path)
21 |
22 | pdb_list = []
23 | for task in MMSPlugin.binaries:
24 | # This hardly assumes there's only 1 targetted platform and would be overwritten
25 | # with whatever comes last if multiple are used!
26 | with open(os.path.join(builder.buildPath, MMSPlugin.plugin_name + '.vdf'), 'w') as fp:
27 | fp.write('"Metamod Plugin"\n')
28 | fp.write('{\n')
29 | fp.write(f'\t"alias"\t"{MMSPlugin.plugin_alias}"\n')
30 | if task.target.arch == 'x86_64':
31 | fp.write(f'\t"file"\t"{os.path.join(bin64_folder_path, MMSPlugin.plugin_name)}"\n')
32 | else:
33 | fp.write(f'\t"file"\t"{os.path.join(bin_folder_path, MMSPlugin.plugin_name)}"\n')
34 | fp.write('}\n')
35 |
36 | if task.target.arch == 'x86_64':
37 | builder.AddCopy(task.binary, bin64_folder)
38 | else:
39 | builder.AddCopy(task.binary, bin_folder)
40 |
41 | if task.debug:
42 | pdb_list.append(task.debug)
43 |
44 | builder.AddCopy(os.path.join(builder.buildPath, MMSPlugin.plugin_name + '.vdf'), metamod_folder)
45 |
46 | # Generate PDB info.
47 | with open(os.path.join(builder.buildPath, 'pdblog.txt'), 'wt') as fp:
48 | for line in pdb_list:
49 | fp.write(line.path + '\n')
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | ## Manual building example
2 |
3 | ### Prerequisites
4 | * [hl2sdk](https://github.com/alliedmodders/hl2sdk) of the game you plan on writing plugin for (the current plugin build scripts allows only for 1 sdk and 1 platform at a time!);
5 | * [metamod-source](https://github.com/alliedmodders/metamod-source);
6 | * [python3](https://www.python.org/)
7 | * [ambuild](https://github.com/alliedmodders/ambuild), make sure ``ambuild`` command is available via the ``PATH`` environment variable;
8 |
9 | ### Setting up
10 | * ``mkdir build`` & ``cd build`` in the root of the plugin folder.
11 | * Open the [MSVC developer console](https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line) with the correct platform (x86 or x86_64) that you plan on targetting.
12 | * Run ``python3 ../configure.py --plugin-name={PLUGIN_NAME} --plugin-alias={PLUGIN_ALIAS} -s {SDKNAME} --targets={TARGET} --mms_path={MMS_PATH} --hl2sdk-root {HL2SDKROOT} `` where:
13 | * ``{PLUGIN_NAME}`` should be the plugin name which is used for the resulting binary name and folder naming scheme (this doesn't affect the plugin name you'd see in the plugin list if you don't modify the base plugin functions);
14 | * ``{PLUGIN_ALIAS}`` should be used to set the plugin alias that is used as a short hand version to load, unload, list info etc via the metamod-source menu (example being ``meta unload sample``, where ``sample`` is the alias);
15 | * ``{SDKNAME}`` should be the hl2sdk game name that you are building for;
16 | * ``{TARGET}`` should be the target platform you are targeting (``x86`` or ``x86_64``);
17 | * ``{MMS_PATH}`` should point to the root of the metamod-source folder;
18 | * ``{HL2SDKROOT}`` should point to the root of the hl2sdk's folders, note that it should not point to the actual ``hl2sdk-GAME`` folder but a root parent of it;
19 | * Alternatively ``{MMS_PATH}`` & ``{HL2SDKROOT}`` could be put as a ``PATH`` environment variables, like ``MMSOURCE112=D:\mmsource-1.12`` & ``HL2SDKCS2=D:\hl2sdks\hl2sdk-cs2`` (note the metamod version and that here hl2sdk environment variable should point directly to the game's hl2sdk folder and not to the root of it!)
20 | * Example: ``python3 ../configure.py --plugin-name=sample_mm --plugin-alias=sample -s cs2 --targets=x86_64 --mms_path=D:\mmsource-1.12 --hl2sdk-root=D:\hl2sdks``
21 | * If the process of configuring was successful, you should be able to run ``ambuild`` in the ``\build`` folder to compile the plugin.
22 | * Once the plugin is compiled the files would be packaged and placed in ``\build\package`` folder.
23 | * To run the plugin on the server, place the files preserving the layout provided in ``\package``. Be aware that plugins get loaded either by corresponding ``.vdf`` files (automatic step) in the metamod folder, or by listing them in ``addons/metamod/metaplugins.ini`` file (manual step).
24 |
25 | ## Points of interest
26 | * To generate the VS solution of the plugin with the correct setup, use ``python3 ../configure {CONFIGURE_OPTIONS} --gen=vs``, where ``{CONFIGURE_OPTIONS}`` is your default configuring options that are used when building. As a result ``.vcxproj`` file would be created in the folder where the command was executed.
27 | * To update which ``.cpp`` files gets compiled in or to add new ones, look at ``AMBuilder`` script which has the ``sample_mm.cpp`` being built initially, you can add or edit this however you want to, running ``ambuild`` after editing this script would automatically catch up the changes, no need for the reconfiguration.
28 | * To change the name/version/author/etc that's displayed in the metamod-source menu, make sure to correctly overload and provide the wanted info to the metamod-source, like ``ISmmPlugin::GetAuthor``, ``ISmmPlugin::GetName`` and so on.
29 | * There are also additional arguments for the configuration step that aren't covered here, you can see them by running ``python3 ../configure -h`` from within the ``\build`` folder.
30 | * To add additional linking ``.libs``/defines/include directories, open ``AMBuildScript`` and at the top edit corresponding arrays.
31 | * Sometimes there could be problems with ``ambuild`` not catching up the changes in ``.h`` files, thus producing incorrect (outdated) binaries or even doesn't compile with the new changes. As there's [no full rebuild option](https://github.com/alliedmodders/ambuild/issues/145) to combat this, go to the ``/build`` folder and locate the folder named after the plugin name you've used, deleting that folder and building after should provide the clean build of the project and the described issues should be eliminated.
32 |
33 |
34 | ## For more information on compiling and reading the plugin's source code, see:
35 |
36 | http://wiki.alliedmods.net/Category:Metamod:Source_Development
37 |
38 |
--------------------------------------------------------------------------------
/example/configure.py:
--------------------------------------------------------------------------------
1 | # vim: set sts=2 ts=8 sw=2 tw=99 et:
2 | import sys
3 | try:
4 | from ambuild2 import run, util
5 | except:
6 | try:
7 | import ambuild
8 | sys.stderr.write('It looks like you have AMBuild 1 installed, but this project uses AMBuild 2.\n')
9 | sys.stderr.write('Upgrade to the latest version of AMBuild to continue.\n')
10 | except:
11 | sys.stderr.write('AMBuild must be installed to build this project.\n')
12 | sys.stderr.write('http://www.alliedmods.net/ambuild\n')
13 | sys.exit(1)
14 |
15 | # Hack to show a decent upgrade message, which wasn't done until 2.2.
16 | ambuild_version = getattr(run, 'CURRENT_API', '2.1')
17 | if ambuild_version.startswith('2.1'):
18 | sys.stderr.write("AMBuild 2.2 or higher is required; please update\n")
19 | sys.exit(1)
20 |
21 | parser = run.BuildParser(sourcePath=sys.path[0], api='2.2')
22 | parser.options.add_argument('-n', '--plugin-name', type=str, dest='plugin_name', default=None,
23 | help='Plugin name')
24 | parser.options.add_argument('-a', '--plugin-alias', type=str, dest='plugin_alias', default=None,
25 | help='Plugin alias')
26 | parser.options.add_argument('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
27 | help='Root search folder for HL2SDKs')
28 | parser.options.add_argument('--hl2sdk-manifests', type=str, dest='hl2sdk_manifests', default=None,
29 | help='HL2SDK manifests source tree folder')
30 | parser.options.add_argument('--mms_path', type=str, dest='mms_path', default=None,
31 | help='Metamod:Source source tree folder')
32 | parser.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug',
33 | help='Enable debugging symbols')
34 | parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt',
35 | help='Enable optimization')
36 | parser.options.add_argument('-s', '--sdks', default='all', dest='sdks',
37 | help='Build against specified SDKs; valid args are "all", "present", or '
38 | 'comma-delimited list of engine names (default: "all")')
39 | parser.options.add_argument('--targets', type=str, dest='targets', default=None,
40 | help="Override the target architecture (use commas to separate multiple targets).")
41 | parser.Configure()
42 |
--------------------------------------------------------------------------------
/example/hl2sdk-manifests:
--------------------------------------------------------------------------------
1 | ../hl2sdk-manifests
--------------------------------------------------------------------------------
/example/include/mysql_mm.h:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * Original code from SourceMod
6 | * Copyright (C) 2004-2014 AlliedModders LLC
7 | * =============================================================================
8 | *
9 | * This program is free software; you can redistribute it and/or modify it under
10 | * the terms of the GNU General Public License, version 3.0, as published by the
11 | * Free Software Foundation.
12 | *
13 | * This program is distributed in the hope that it will be useful, but WITHOUT
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 | * details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program. If not, see .
20 | */
21 |
22 | #pragma once
23 |
24 | #include
25 | #include
26 |
27 | #define MYSQLMM_INTERFACE "IMySQLClient"
28 |
29 | class IMySQLQuery;
30 |
31 | typedef std::function ConnectCallbackFunc;
32 | typedef std::function QueryCallbackFunc;
33 |
34 | typedef enum EMySQLType {
35 | MM_MYSQL_TYPE_DECIMAL, MM_MYSQL_TYPE_TINY,
36 | MM_MYSQL_TYPE_SHORT, MM_MYSQL_TYPE_LONG,
37 | MM_MYSQL_TYPE_FLOAT, MM_MYSQL_TYPE_DOUBLE,
38 | MM_MYSQL_TYPE_NULL, MM_MYSQL_TYPE_TIMESTAMP,
39 | MM_MYSQL_TYPE_LONGLONG, MM_MYSQL_TYPE_INT24,
40 | MM_MYSQL_TYPE_DATE, MM_MYSQL_TYPE_TIME,
41 | MM_MYSQL_TYPE_DATETIME, MM_MYSQL_TYPE_YEAR,
42 | MM_MYSQL_TYPE_NEWDATE, MM_MYSQL_TYPE_VARCHAR,
43 | MM_MYSQL_TYPE_BIT,
44 | MM_MYSQL_TYPE_TIMESTAMP2,
45 | MM_MYSQL_TYPE_DATETIME2,
46 | MM_MYSQL_TYPE_TIME2,
47 | MM_MYSQL_TYPE_UNKNOWN,
48 | MM_MYSQL_TYPE_JSON = 245,
49 | MM_MYSQL_TYPE_NEWDECIMAL = 246,
50 | MM_MYSQL_TYPE_ENUM = 247,
51 | MM_MYSQL_TYPE_SET = 248,
52 | MM_MYSQL_TYPE_TINY_BLOB = 249,
53 | MM_MYSQL_TYPE_MEDIUM_BLOB = 250,
54 | MM_MYSQL_TYPE_LONG_BLOB = 251,
55 | MM_MYSQL_TYPE_BLOB = 252,
56 | MM_MYSQL_TYPE_VAR_STRING = 253,
57 | MM_MYSQL_TYPE_STRING = 254,
58 | MM_MYSQL_TYPE_GEOMETRY = 255
59 | } EMySQLType;
60 |
61 | class IMySQLRow
62 | {
63 | public:
64 | };
65 |
66 | class IMySQLResult
67 | {
68 | public:
69 | virtual int GetRowCount() = 0;
70 | virtual int GetFieldCount() = 0;
71 | virtual bool FieldNameToNum(const char* name, unsigned int* columnId) = 0;
72 | virtual const char* FieldNumToName(unsigned int colId) = 0;
73 | virtual bool MoreRows() = 0;
74 | virtual IMySQLRow* FetchRow() = 0;
75 | virtual IMySQLRow* CurrentRow() = 0;
76 | virtual bool Rewind() = 0;
77 | virtual EMySQLType GetFieldType(unsigned int field) = 0;
78 | virtual char* GetString(unsigned int columnId, size_t* length = nullptr) = 0;
79 | virtual size_t GetDataSize(unsigned int columnId) = 0;
80 | virtual float GetFloat(unsigned int columnId) = 0;
81 | virtual int GetInt(unsigned int columnId) = 0;
82 | virtual bool IsNull(unsigned int columnId) = 0;
83 | };
84 |
85 | class IMySQLQuery
86 | {
87 | public:
88 | virtual IMySQLResult* GetResultSet() = 0;
89 | virtual bool FetchMoreResults() = 0;
90 | virtual unsigned int GetInsertId() = 0;
91 | virtual unsigned int GetAffectedRows() = 0;
92 | };
93 |
94 | struct MySQLConnectionInfo
95 | {
96 | const char* host;
97 | const char* user;
98 | const char* pass;
99 | const char* database;
100 | int port = 3306;
101 | int timeout = 60;
102 | };
103 |
104 | class IMySQLConnection
105 | {
106 | public:
107 | virtual void Connect(ConnectCallbackFunc callback) = 0;
108 | virtual void Query(char* query, QueryCallbackFunc callback) = 0;
109 | virtual void Query(const char* query, QueryCallbackFunc callback, ...) = 0;
110 | virtual void Destroy() = 0;
111 | virtual std::string Escape(char* string) = 0;
112 | virtual std::string Escape(const char* string) = 0;
113 | };
114 |
115 | class IMySQLClient
116 | {
117 | public:
118 | virtual IMySQLConnection* CreateMySQLConnection(MySQLConnectionInfo info) = 0;
119 | };
--------------------------------------------------------------------------------
/example/sample_mm.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * vim: set ts=4 sw=4 tw=99 noet :
3 | * ======================================================
4 | * Metamod:Source Sample Plugin
5 | * Written by AlliedModders LLC.
6 | * ======================================================
7 | *
8 | * This software is provided 'as-is', without any express or implied warranty.
9 | * In no event will the authors be held liable for any damages arising from
10 | * the use of this software.
11 | *
12 | * This sample plugin is public domain.
13 | */
14 |
15 | #include
16 | #include "sample_mm.h"
17 | #include "iserver.h"
18 | #include "include/mysql_mm.h"
19 |
20 | IMySQLClient *g_pMysqlClient;
21 | IMySQLConnection* g_pConnection;
22 |
23 | SamplePlugin g_SamplePlugin;
24 |
25 | PLUGIN_EXPOSE(SamplePlugin, g_SamplePlugin);
26 | bool SamplePlugin::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
27 | {
28 | PLUGIN_SAVEVARS();
29 |
30 | g_SMAPI->AddListener( this, this );
31 |
32 | META_CONPRINTF( "Starting plugin.\n" );
33 |
34 | return true;
35 | }
36 |
37 | bool SamplePlugin::Unload(char *error, size_t maxlen)
38 | {
39 | if (g_pConnection)
40 | g_pConnection->Destroy();
41 |
42 | return true;
43 | }
44 |
45 | void SamplePlugin::AllPluginsLoaded()
46 | {
47 |
48 | int ret;
49 | g_pMysqlClient = (IMySQLClient*)g_SMAPI->MetaFactory(MYSQLMM_INTERFACE, &ret, NULL);
50 |
51 | if (ret == META_IFACE_FAILED)
52 | {
53 | ConMsg("Failed to lookup mysql client. Aborting");
54 | return;
55 | }
56 |
57 | MySQLConnectionInfo info{ .host = "test", .user = "test", .pass = "test", .database = "test" };
58 | g_pConnection = g_pMysqlClient->CreateMySQLConnection(info);
59 |
60 | g_pConnection->Connect([](bool connect) {
61 | if (connect)
62 | {
63 | ConMsg("CONNECTED\n");
64 |
65 | g_pConnection->Query("SELECT * FROM test1", [](IMySQLQuery* test)
66 | {
67 | auto results = test->GetResultSet();
68 | ConMsg("Callback rows %i\n", results->GetRowCount());
69 | while (results->FetchRow())
70 | {
71 | ConMsg("ID: %i, str: %s\n", results->GetInt(0), results->GetString(1));
72 | }
73 | });
74 | }
75 | else
76 | {
77 | ConMsg("Failed to connect\n");
78 |
79 | // make sure to properly destroy the connection
80 | g_pConnection->Destroy();
81 | g_pConnection = nullptr;
82 | }
83 | });
84 |
85 |
86 | }
87 |
88 | void SamplePlugin::OnLevelInit( char const *pMapName,
89 | char const *pMapEntities,
90 | char const *pOldLevel,
91 | char const *pLandmarkName,
92 | bool loadGame,
93 | bool background )
94 | {
95 | }
96 |
97 | void SamplePlugin::OnLevelShutdown()
98 | {
99 | }
100 |
101 | bool SamplePlugin::Pause(char *error, size_t maxlen)
102 | {
103 | return true;
104 | }
105 |
106 | bool SamplePlugin::Unpause(char *error, size_t maxlen)
107 | {
108 | return true;
109 | }
110 |
111 | const char *SamplePlugin::GetLicense()
112 | {
113 | return "Public Domain";
114 | }
115 |
116 | const char *SamplePlugin::GetVersion()
117 | {
118 | return "1.0.0.0";
119 | }
120 |
121 | const char *SamplePlugin::GetDate()
122 | {
123 | return __DATE__;
124 | }
125 |
126 | const char *SamplePlugin::GetLogTag()
127 | {
128 | return "SAMPLE";
129 | }
130 |
131 | const char *SamplePlugin::GetAuthor()
132 | {
133 | return "AlliedModders LLC";
134 | }
135 |
136 | const char *SamplePlugin::GetDescription()
137 | {
138 | return "Sample basic plugin";
139 | }
140 |
141 | const char *SamplePlugin::GetName()
142 | {
143 | return "Sample Plugin";
144 | }
145 |
146 | const char *SamplePlugin::GetURL()
147 | {
148 | return "http://www.sourcemm.net/";
149 | }
150 |
--------------------------------------------------------------------------------
/example/sample_mm.h:
--------------------------------------------------------------------------------
1 | /**
2 | * vim: set ts=4 sw=4 tw=99 noet :
3 | * ======================================================
4 | * Metamod:Source Sample Plugin
5 | * Written by AlliedModders LLC.
6 | * ======================================================
7 | *
8 | * This software is provided 'as-is', without any express or implied warranty.
9 | * In no event will the authors be held liable for any damages arising from
10 | * the use of this software.
11 | *
12 | * This sample plugin is public domain.
13 | */
14 |
15 | #ifndef _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
16 | #define _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
17 |
18 | #include
19 | #include
20 | #include
21 | #include
22 |
23 | class SamplePlugin : public ISmmPlugin, public IMetamodListener
24 | {
25 | public:
26 | bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
27 | bool Unload(char *error, size_t maxlen);
28 | bool Pause(char *error, size_t maxlen);
29 | bool Unpause(char *error, size_t maxlen);
30 | void AllPluginsLoaded();
31 | public: //hooks
32 | void OnLevelInit( char const *pMapName,
33 | char const *pMapEntities,
34 | char const *pOldLevel,
35 | char const *pLandmarkName,
36 | bool loadGame,
37 | bool background );
38 | void OnLevelShutdown();
39 | void Hook_GameFrame( bool simulating, bool bFirstTick, bool bLastTick );
40 | void Hook_ClientActive( CPlayerSlot slot, bool bLoadGame, const char *pszName, uint64 xuid );
41 | void Hook_ClientDisconnect( CPlayerSlot slot, int reason, const char *pszName, uint64 xuid, const char *pszNetworkID );
42 | void Hook_ClientPutInServer( CPlayerSlot slot, char const *pszName, int type, uint64 xuid );
43 | void Hook_ClientSettingsChanged( CPlayerSlot slot );
44 | void Hook_OnClientConnected( CPlayerSlot slot, const char *pszName, uint64 xuid, const char *pszNetworkID, const char *pszAddress, bool bFakePlayer );
45 | bool Hook_ClientConnect( CPlayerSlot slot, const char *pszName, uint64 xuid, const char *pszNetworkID, bool unk1, CBufferString *pRejectReason );
46 | void Hook_ClientCommand( CPlayerSlot nSlot, const CCommand &_cmd );
47 | public:
48 | const char *GetAuthor();
49 | const char *GetName();
50 | const char *GetDescription();
51 | const char *GetURL();
52 | const char *GetLicense();
53 | const char *GetVersion();
54 | const char *GetDate();
55 | const char *GetLogTag();
56 | };
57 |
58 | extern SamplePlugin g_SamplePlugin;
59 |
60 | PLUGIN_GLOBALVARS();
61 |
62 | #endif //_INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
63 |
--------------------------------------------------------------------------------
/mysql_mm.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.3.32825.248
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_mm", "mysql_mm.vcxproj", "{2A734041-5881-4EA1-BF05-46F361443AF3}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {2A734041-5881-4EA1-BF05-46F361443AF3}.Debug|x64.ActiveCfg = Debug|x64
17 | {2A734041-5881-4EA1-BF05-46F361443AF3}.Debug|x64.Build.0 = Debug|x64
18 | {2A734041-5881-4EA1-BF05-46F361443AF3}.Debug|x86.ActiveCfg = Debug|Win32
19 | {2A734041-5881-4EA1-BF05-46F361443AF3}.Debug|x86.Build.0 = Debug|Win32
20 | {2A734041-5881-4EA1-BF05-46F361443AF3}.Release|x64.ActiveCfg = Release|x64
21 | {2A734041-5881-4EA1-BF05-46F361443AF3}.Release|x64.Build.0 = Release|x64
22 | {2A734041-5881-4EA1-BF05-46F361443AF3}.Release|x86.ActiveCfg = Release|Win32
23 | {2A734041-5881-4EA1-BF05-46F361443AF3}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {12C11272-4784-4DD0-A905-B564ECADA421}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/mysql_mm.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {70725d9f-1e21-48d9-ad02-3bbc3c826268}
10 | h;hpp;hxx;hm;inl
11 |
12 |
13 | {650d8361-965b-4380-b410-e2c906add745}
14 |
15 |
16 | {fe6c97b0-5e88-42d9-b12f-1fa8063e23b9}
17 |
18 |
19 | {f36eabff-4948-4353-89ad-aeb51afc3efc}
20 |
21 |
22 |
23 |
24 | Source Files
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files\operations
31 |
32 |
33 | Source Files\operations
34 |
35 |
36 | Source Files
37 |
38 |
39 | Source Files
40 |
41 |
42 |
43 |
44 | Header Files
45 |
46 |
47 | Header Files
48 |
49 |
50 | Header Files\operations
51 |
52 |
53 | Header Files\operations
54 |
55 |
56 | Header Files\public
57 |
58 |
59 | Header Files
60 |
61 |
62 | Header Files
63 |
64 |
65 |
--------------------------------------------------------------------------------
/mysql_mm.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/database.h:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * =============================================================================
6 | *
7 | * This program is free software; you can redistribute it and/or modify it under
8 | * the terms of the GNU General Public License, version 3.0, as published by the
9 | * Free Software Foundation.
10 | *
11 | * This program is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #ifdef WIN32
23 | #include
24 | #include
25 | #else
26 | #include
27 | #endif
28 |
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include "public/mysql_mm.h"
34 |
35 | class ThreadOperation
36 | {
37 | public:
38 | virtual void RunThreadPart() = 0;
39 | virtual void CancelThinkPart() = 0;
40 | virtual void RunThinkPart() = 0;
41 | private:
42 | };
43 |
44 |
45 | class MySQLConnection : public IMySQLConnection
46 | {
47 | public:
48 | MySQLConnection(const MySQLConnectionInfo info);
49 | ~MySQLConnection();
50 | void Connect(ConnectCallbackFunc callback);
51 | void Query(char* query, QueryCallbackFunc callback);
52 | void Query(const char* query, QueryCallbackFunc callback, ...);
53 | void Destroy();
54 | void RunFrame();
55 | void SetDatabase(MYSQL* db) { m_pDatabase = db; }
56 | MYSQL* GetDatabase() { return m_pDatabase; }
57 | unsigned int GetInsertID();
58 | unsigned int GetAffectedRows();
59 | std::string Escape(char* string);
60 | std::string Escape(const char* string);
61 |
62 | MySQLConnectionInfo m_info;
63 | private:
64 | void ThreadRun();
65 | void AddToThreadQueue(ThreadOperation* threadOperation);
66 |
67 | std::queue m_threadQueue;
68 | std::queue m_ThinkQueue;
69 | std::unique_ptr m_thread;
70 | std::condition_variable m_QueueEvent;
71 | std::mutex m_Lock;
72 | std::mutex m_ThinkLock;
73 | bool m_Terminate = false;
74 | MYSQL* m_pDatabase = nullptr;
75 | };
--------------------------------------------------------------------------------
/src/mysql_client.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * =============================================================================
6 | *
7 | * This program is free software; you can redistribute it and/or modify it under
8 | * the terms of the GNU General Public License, version 3.0, as published by the
9 | * Free Software Foundation.
10 | *
11 | * This program is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program. If not, see .
18 | */
19 |
20 | #include "mysql_client.h"
21 | #include "database.h"
22 | #include "tier0/dbg.h"
23 |
24 | extern std::vector g_vecMysqlConnections;
25 |
26 | IMySQLConnection* CMySQLClient::CreateMySQLConnection(MySQLConnectionInfo info)
27 | {
28 | auto connection = new MySQLConnection(info);
29 | g_vecMysqlConnections.push_back(connection);
30 |
31 | return connection;
32 | }
--------------------------------------------------------------------------------
/src/mysql_client.h:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * =============================================================================
6 | *
7 | * This program is free software; you can redistribute it and/or modify it under
8 | * the terms of the GNU General Public License, version 3.0, as published by the
9 | * Free Software Foundation.
10 | *
11 | * This program is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program. If not, see .
18 | */
19 |
20 |
21 | #pragma once
22 |
23 | #include "public/mysql_mm.h"
24 |
25 | class CMySQLClient : public IMySQLClient
26 | {
27 | public:
28 | IMySQLConnection* CreateMySQLConnection(MySQLConnectionInfo info);
29 | };
--------------------------------------------------------------------------------
/src/mysql_mm.h:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * =============================================================================
6 | *
7 | * This program is free software; you can redistribute it and/or modify it under
8 | * the terms of the GNU General Public License, version 3.0, as published by the
9 | * Free Software Foundation.
10 | *
11 | * This program is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program. If not, see .
18 | */
19 |
20 | #ifndef _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
21 | #define _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | class MySQLPlugin : public ISmmPlugin, public IMetamodListener
29 | {
30 | public:
31 | bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
32 | bool Unload(char *error, size_t maxlen);
33 | bool Pause(char *error, size_t maxlen);
34 | bool Unpause(char *error, size_t maxlen);
35 | void AllPluginsLoaded();
36 | void* OnMetamodQuery(const char* iface, int* ret);
37 | public: //hooks
38 | void OnLevelInit( char const *pMapName,
39 | char const *pMapEntities,
40 | char const *pOldLevel,
41 | char const *pLandmarkName,
42 | bool loadGame,
43 | bool background );
44 | void OnLevelShutdown();
45 | void Hook_GameFrame( bool simulating, bool bFirstTick, bool bLastTick );
46 | void Hook_ClientActive( CPlayerSlot slot, bool bLoadGame, const char *pszName, uint64 xuid );
47 | void Hook_ClientDisconnect( CPlayerSlot slot, int reason, const char *pszName, uint64 xuid, const char *pszNetworkID );
48 | void Hook_ClientPutInServer( CPlayerSlot slot, char const *pszName, int type, uint64 xuid );
49 | void Hook_ClientSettingsChanged( CPlayerSlot slot );
50 | void Hook_OnClientConnected( CPlayerSlot slot, const char *pszName, uint64 xuid, const char *pszNetworkID, const char *pszAddress, bool bFakePlayer );
51 | bool Hook_ClientConnect( CPlayerSlot slot, const char *pszName, uint64 xuid, const char *pszNetworkID, bool unk1, CBufferString *pRejectReason );
52 | void Hook_ClientCommand( CPlayerSlot nSlot, const CCommand &_cmd );
53 | public:
54 | const char *GetAuthor();
55 | const char *GetName();
56 | const char *GetDescription();
57 | const char *GetURL();
58 | const char *GetLicense();
59 | const char *GetVersion();
60 | const char *GetDate();
61 | const char *GetLogTag();
62 | };
63 |
64 | extern MySQLPlugin g_MySQLPlugin;
65 |
66 | PLUGIN_GLOBALVARS();
67 |
68 | #endif //_INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
69 |
--------------------------------------------------------------------------------
/src/mysql_result.h:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * Original code from SourceMod
6 | * Copyright (C) 2004-2014 AlliedModders LLC
7 | * =============================================================================
8 | *
9 | * This program is free software; you can redistribute it and/or modify it under
10 | * the terms of the GNU General Public License, version 3.0, as published by the
11 | * Free Software Foundation.
12 | *
13 | * This program is distributed in the hope that it will be useful, but WITHOUT
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 | * details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program. If not, see .
20 | */
21 |
22 | #pragma once
23 |
24 | #include "database.h"
25 | #include "public/mysql_mm.h"
26 |
27 | class MySQLConnection;
28 | class CMySQLQuery;
29 |
30 | class CMySQLResult : public IMySQLResult, IMySQLRow
31 | {
32 | friend class CMySQLQuery;
33 | public:
34 | CMySQLResult(MYSQL_RES* res);
35 |
36 | void Update();
37 |
38 | int GetRowCount();
39 | int GetFieldCount();
40 | bool FieldNameToNum(const char* name, unsigned int* columnId);
41 | const char* FieldNumToName(unsigned int colId);
42 | bool MoreRows();
43 | IMySQLRow* FetchRow();
44 | IMySQLRow* CurrentRow();
45 | bool Rewind();
46 | EMySQLType GetFieldType(unsigned int field);
47 | char* GetString(unsigned int columnId, size_t* length = nullptr);
48 | size_t GetDataSize(unsigned int columnId);
49 | float GetFloat(unsigned int columnId);
50 | int GetInt(unsigned int columnId);
51 | bool IsNull(unsigned int columnId);
52 |
53 | private:
54 | //MYSQL* m_pDatabase;
55 | MYSQL_RES* m_pRes;
56 |
57 | unsigned int m_ColCount = 0;
58 | unsigned int m_RowCount = 0;
59 | unsigned int m_CurRow = 0;
60 | MYSQL_ROW m_Row;
61 | unsigned long* m_Lengths = 0;
62 | };
63 |
64 | class CMySQLQuery : public IMySQLQuery
65 | {
66 | friend class CMySQLResult;
67 | public:
68 | CMySQLQuery(MySQLConnection* db, MYSQL_RES* res);
69 | ~CMySQLQuery();
70 | IMySQLResult* GetResultSet();
71 | bool FetchMoreResults();
72 | unsigned int GetInsertId();
73 | unsigned int GetAffectedRows();
74 | private:
75 | MySQLConnection* m_pDatabase;
76 | CMySQLResult m_res;
77 | unsigned int m_insertId;
78 | unsigned int m_affectedRows;
79 | };
--------------------------------------------------------------------------------
/src/network_connection.pb.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | typedef int ENetworkDisconnectionReason;
--------------------------------------------------------------------------------
/src/operations/connect.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * Original code from SourceMod
6 | * Copyright (C) 2004-2014 AlliedModders LLC
7 | * =============================================================================
8 | *
9 | * This program is free software; you can redistribute it and/or modify it under
10 | * the terms of the GNU General Public License, version 3.0, as published by the
11 | * Free Software Foundation.
12 | *
13 | * This program is distributed in the hope that it will be useful, but WITHOUT
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 | * details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program. If not, see .
20 | */
21 |
22 | #include "connect.h"
23 | #include "tier0/dbg.h"
24 |
25 | void TConnectOp::RunThreadPart()
26 | {
27 | m_szError[0] = '\0';
28 | MYSQL* mysql = mysql_init(NULL);
29 |
30 | if (!mysql)
31 | Error("Uh oh, mysql is null!");
32 |
33 | const char* host = NULL, * socket = NULL;
34 |
35 | int timeout = 60;
36 |
37 | mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (const char*)&timeout);
38 | mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (const char*)&timeout);
39 | mysql_options(mysql, MYSQL_OPT_WRITE_TIMEOUT, (const char*)&timeout);
40 |
41 | bool my_true = true;
42 | mysql_options(mysql, MYSQL_OPT_RECONNECT, (const char*)&my_true); // deprecated
43 |
44 | if (m_pCon->m_info.host[0] == '/')
45 | {
46 | host = "localhost";
47 | socket = host;
48 | }
49 | else
50 | {
51 | host = m_pCon->m_info.host;
52 | socket = NULL;
53 | }
54 |
55 | if (!mysql_real_connect(mysql,
56 | host,
57 | m_pCon->m_info.user,
58 | m_pCon->m_info.pass,
59 | m_pCon->m_info.database,
60 | m_pCon->m_info.port,
61 | socket,
62 | ((1) << 17)))
63 | {
64 |
65 | mysql_close(mysql);
66 | strncpy(m_szError, mysql_error(mysql), sizeof m_szError);
67 | return;
68 | }
69 |
70 | m_pDatabase = mysql;
71 | }
72 |
73 | void TConnectOp::RunThinkPart()
74 | {
75 | if (m_szError[0])
76 | ConMsg("Failed to establish a MySQL connection: %s\n", m_szError);
77 |
78 | m_pCon->SetDatabase(m_pDatabase);
79 | m_callback(m_pDatabase != nullptr);
80 | }
81 |
82 | void TConnectOp::CancelThinkPart()
83 | {
84 | mysql_close(m_pDatabase);
85 | m_pCon->SetDatabase(nullptr);
86 | }
--------------------------------------------------------------------------------
/src/operations/connect.h:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * Original code from SourceMod
6 | * Copyright (C) 2004-2014 AlliedModders LLC
7 | * =============================================================================
8 | *
9 | * This program is free software; you can redistribute it and/or modify it under
10 | * the terms of the GNU General Public License, version 3.0, as published by the
11 | * Free Software Foundation.
12 | *
13 | * This program is distributed in the hope that it will be useful, but WITHOUT
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 | * details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program. If not, see .
20 | */
21 |
22 | #pragma once
23 | #include "../database.h"
24 |
25 | class TConnectOp : public ThreadOperation
26 | {
27 | public:
28 | TConnectOp(MySQLConnection* con, ConnectCallbackFunc func) : m_pCon(con), m_callback(func)
29 | {
30 |
31 | }
32 |
33 | void RunThreadPart();
34 | void CancelThinkPart();
35 | void RunThinkPart();
36 | private:
37 | MySQLConnection* m_pCon;
38 | ConnectCallbackFunc m_callback;
39 | MYSQL* m_pDatabase = nullptr;
40 | char m_szError[255];
41 | };
--------------------------------------------------------------------------------
/src/operations/query.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * Original code from SourceMod
6 | * Copyright (C) 2004-2014 AlliedModders LLC
7 | * =============================================================================
8 | *
9 | * This program is free software; you can redistribute it and/or modify it under
10 | * the terms of the GNU General Public License, version 3.0, as published by the
11 | * Free Software Foundation.
12 | *
13 | * This program is distributed in the hope that it will be useful, but WITHOUT
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 | * details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program. If not, see .
20 | */
21 |
22 | #include "query.h"
23 | #include "tier0/dbg.h"
24 | #include "../mysql_result.h"
25 |
26 | TQueryOp::~TQueryOp()
27 | {
28 | delete m_pQuery;
29 | }
30 |
31 | void TQueryOp::RunThreadPart()
32 | {
33 | auto pDatabase = m_pCon->GetDatabase();
34 | m_szError[0] = '\0';
35 | if (mysql_query(pDatabase, m_szQuery.c_str()))
36 | {
37 | V_snprintf(m_szError, sizeof m_szError, "MySQL query error: %s\n", mysql_error(pDatabase));
38 | return;
39 | }
40 |
41 | if (mysql_field_count(pDatabase))
42 | m_res = mysql_store_result(pDatabase);
43 | }
44 |
45 | void TQueryOp::RunThinkPart()
46 | {
47 | if(m_szError[0])
48 | {
49 | ConMsg("%s\n", m_szError);
50 | return;
51 | }
52 |
53 | m_pQuery = new CMySQLQuery(m_pCon, m_res);
54 | m_callback(m_pQuery);
55 | }
56 |
57 | void TQueryOp::CancelThinkPart()
58 | {
59 | mysql_close(m_pCon->GetDatabase());
60 | m_pCon->SetDatabase(nullptr);
61 | }
62 |
--------------------------------------------------------------------------------
/src/operations/query.h:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * Original code from SourceMod
6 | * Copyright (C) 2004-2014 AlliedModders LLC
7 | * =============================================================================
8 | *
9 | * This program is free software; you can redistribute it and/or modify it under
10 | * the terms of the GNU General Public License, version 3.0, as published by the
11 | * Free Software Foundation.
12 | *
13 | * This program is distributed in the hope that it will be useful, but WITHOUT
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 | * details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program. If not, see .
20 | */
21 |
22 | #pragma once
23 | #include "../database.h"
24 | #include "../mysql_result.h"
25 |
26 | class TQueryOp : public ThreadOperation
27 | {
28 | public:
29 | TQueryOp(MySQLConnection* con, std::string query, QueryCallbackFunc func) : m_pCon(con), m_szQuery(query), m_callback(func)
30 | {
31 |
32 | }
33 |
34 | ~TQueryOp();
35 |
36 | void RunThreadPart();
37 | void CancelThinkPart();
38 | void RunThinkPart();
39 | private:
40 | MySQLConnection* m_pCon;
41 | std::string m_szQuery;
42 | QueryCallbackFunc m_callback;
43 | MYSQL_RES* m_res = nullptr;
44 | CMySQLQuery* m_pQuery = nullptr;
45 | char m_szError[255];
46 | };
--------------------------------------------------------------------------------
/src/public/mysql_mm.h:
--------------------------------------------------------------------------------
1 | /**
2 | * =============================================================================
3 | * CS2Fixes
4 | * Copyright (C) 2023 Source2ZE
5 | * Original code from SourceMod
6 | * Copyright (C) 2004-2014 AlliedModders LLC
7 | * =============================================================================
8 | *
9 | * This program is free software; you can redistribute it and/or modify it under
10 | * the terms of the GNU General Public License, version 3.0, as published by the
11 | * Free Software Foundation.
12 | *
13 | * This program is distributed in the hope that it will be useful, but WITHOUT
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 | * details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program. If not, see .
20 | */
21 |
22 | #pragma once
23 |
24 | #include
25 | #include
26 |
27 | #define MYSQLMM_INTERFACE "IMySQLClient"
28 |
29 | class IMySQLQuery;
30 |
31 | typedef std::function ConnectCallbackFunc;
32 | typedef std::function QueryCallbackFunc;
33 |
34 | typedef enum EMySQLType {
35 | MM_MYSQL_TYPE_DECIMAL, MM_MYSQL_TYPE_TINY,
36 | MM_MYSQL_TYPE_SHORT, MM_MYSQL_TYPE_LONG,
37 | MM_MYSQL_TYPE_FLOAT, MM_MYSQL_TYPE_DOUBLE,
38 | MM_MYSQL_TYPE_NULL, MM_MYSQL_TYPE_TIMESTAMP,
39 | MM_MYSQL_TYPE_LONGLONG, MM_MYSQL_TYPE_INT24,
40 | MM_MYSQL_TYPE_DATE, MM_MYSQL_TYPE_TIME,
41 | MM_MYSQL_TYPE_DATETIME, MM_MYSQL_TYPE_YEAR,
42 | MM_MYSQL_TYPE_NEWDATE, MM_MYSQL_TYPE_VARCHAR,
43 | MM_MYSQL_TYPE_BIT,
44 | MM_MYSQL_TYPE_TIMESTAMP2,
45 | MM_MYSQL_TYPE_DATETIME2,
46 | MM_MYSQL_TYPE_TIME2,
47 | MM_MYSQL_TYPE_UNKNOWN,
48 | MM_MYSQL_TYPE_JSON = 245,
49 | MM_MYSQL_TYPE_NEWDECIMAL = 246,
50 | MM_MYSQL_TYPE_ENUM = 247,
51 | MM_MYSQL_TYPE_SET = 248,
52 | MM_MYSQL_TYPE_TINY_BLOB = 249,
53 | MM_MYSQL_TYPE_MEDIUM_BLOB = 250,
54 | MM_MYSQL_TYPE_LONG_BLOB = 251,
55 | MM_MYSQL_TYPE_BLOB = 252,
56 | MM_MYSQL_TYPE_VAR_STRING = 253,
57 | MM_MYSQL_TYPE_STRING = 254,
58 | MM_MYSQL_TYPE_GEOMETRY = 255
59 | } EMySQLType;
60 |
61 | class IMySQLRow
62 | {
63 | public:
64 | };
65 |
66 | class IMySQLResult
67 | {
68 | public:
69 | virtual int GetRowCount() = 0;
70 | virtual int GetFieldCount() = 0;
71 | virtual bool FieldNameToNum(const char* name, unsigned int* columnId) = 0;
72 | virtual const char* FieldNumToName(unsigned int colId) = 0;
73 | virtual bool MoreRows() = 0;
74 | virtual IMySQLRow* FetchRow() = 0;
75 | virtual IMySQLRow* CurrentRow() = 0;
76 | virtual bool Rewind() = 0;
77 | virtual EMySQLType GetFieldType(unsigned int field) = 0;
78 | virtual char* GetString(unsigned int columnId, size_t* length = nullptr) = 0;
79 | virtual size_t GetDataSize(unsigned int columnId) = 0;
80 | virtual float GetFloat(unsigned int columnId) = 0;
81 | virtual int GetInt(unsigned int columnId) = 0;
82 | virtual bool IsNull(unsigned int columnId) = 0;
83 | };
84 |
85 | class IMySQLQuery
86 | {
87 | public:
88 | virtual IMySQLResult* GetResultSet() = 0;
89 | virtual bool FetchMoreResults() = 0;
90 | virtual unsigned int GetInsertId() = 0;
91 | virtual unsigned int GetAffectedRows() = 0;
92 | };
93 |
94 | struct MySQLConnectionInfo
95 | {
96 | const char* host;
97 | const char* user;
98 | const char* pass;
99 | const char* database;
100 | int port = 3306;
101 | int timeout = 60;
102 | };
103 |
104 | class IMySQLConnection
105 | {
106 | public:
107 | virtual void Connect(ConnectCallbackFunc callback) = 0;
108 | virtual void Query(char* query, QueryCallbackFunc callback) = 0;
109 | virtual void Query(const char* query, QueryCallbackFunc callback, ...) = 0;
110 | virtual void Destroy() = 0;
111 | virtual std::string Escape(char* string) = 0;
112 | virtual std::string Escape(const char* string) = 0;
113 | };
114 |
115 | class IMySQLClient
116 | {
117 | public:
118 | virtual IMySQLConnection* CreateMySQLConnection(MySQLConnectionInfo info) = 0;
119 | };
--------------------------------------------------------------------------------
/vendor/mysql/include/big_endian.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #include
24 |
25 | /*
26 | Data in big-endian format.
27 | */
28 | static inline void float4store(uchar *T, float A)
29 | { *(T)= ((uchar *) &A)[3];
30 | *((T)+1)=(char) ((uchar *) &A)[2];
31 | *((T)+2)=(char) ((uchar *) &A)[1];
32 | *((T)+3)=(char) ((uchar *) &A)[0]; }
33 |
34 | static inline void float4get (float *V, const uchar *M)
35 | { float def_temp;
36 | ((uchar*) &def_temp)[0]=(M)[3];
37 | ((uchar*) &def_temp)[1]=(M)[2];
38 | ((uchar*) &def_temp)[2]=(M)[1];
39 | ((uchar*) &def_temp)[3]=(M)[0];
40 | (*V)=def_temp; }
41 |
42 | static inline void float8store(uchar *T, double V)
43 | { *(T)= ((uchar *) &V)[7];
44 | *((T)+1)=(char) ((uchar *) &V)[6];
45 | *((T)+2)=(char) ((uchar *) &V)[5];
46 | *((T)+3)=(char) ((uchar *) &V)[4];
47 | *((T)+4)=(char) ((uchar *) &V)[3];
48 | *((T)+5)=(char) ((uchar *) &V)[2];
49 | *((T)+6)=(char) ((uchar *) &V)[1];
50 | *((T)+7)=(char) ((uchar *) &V)[0]; }
51 |
52 | static inline void float8get (double *V, const uchar *M)
53 | { double def_temp;
54 | ((uchar*) &def_temp)[0]=(M)[7];
55 | ((uchar*) &def_temp)[1]=(M)[6];
56 | ((uchar*) &def_temp)[2]=(M)[5];
57 | ((uchar*) &def_temp)[3]=(M)[4];
58 | ((uchar*) &def_temp)[4]=(M)[3];
59 | ((uchar*) &def_temp)[5]=(M)[2];
60 | ((uchar*) &def_temp)[6]=(M)[1];
61 | ((uchar*) &def_temp)[7]=(M)[0];
62 | (*V) = def_temp; }
63 |
64 | static inline void ushortget(uint16 *V, const uchar *pM)
65 | { *V = (uint16) (((uint16) ((uchar) (pM)[1]))+
66 | ((uint16) ((uint16) (pM)[0]) << 8)); }
67 | static inline void shortget (int16 *V, const uchar *pM)
68 | { *V = (short) (((short) ((uchar) (pM)[1]))+
69 | ((short) ((short) (pM)[0]) << 8)); }
70 | static inline void longget (int32 *V, const uchar *pM)
71 | { int32 def_temp;
72 | ((uchar*) &def_temp)[0]=(pM)[0];
73 | ((uchar*) &def_temp)[1]=(pM)[1];
74 | ((uchar*) &def_temp)[2]=(pM)[2];
75 | ((uchar*) &def_temp)[3]=(pM)[3];
76 | (*V)=def_temp; }
77 | static inline void ulongget (uint32 *V, const uchar *pM)
78 | { uint32 def_temp;
79 | ((uchar*) &def_temp)[0]=(pM)[0];
80 | ((uchar*) &def_temp)[1]=(pM)[1];
81 | ((uchar*) &def_temp)[2]=(pM)[2];
82 | ((uchar*) &def_temp)[3]=(pM)[3];
83 | (*V)=def_temp; }
84 | static inline void shortstore(uchar *T, int16 A)
85 | { uint def_temp=(uint) (A) ;
86 | *(((char*)T)+1)=(char)(def_temp);
87 | *(((char*)T)+0)=(char)(def_temp >> 8); }
88 | static inline void longstore (uchar *T, int32 A)
89 | { *(((char*)T)+3)=((A));
90 | *(((char*)T)+2)=(((A) >> 8));
91 | *(((char*)T)+1)=(((A) >> 16));
92 | *(((char*)T)+0)=(((A) >> 24)); }
93 |
94 | static inline void floatget(float *V, const uchar *M)
95 | {
96 | memcpy(V, (M), sizeof(float));
97 | }
98 |
99 | static inline void floatstore(uchar *T, float V)
100 | {
101 | memcpy((T), (&V), sizeof(float));
102 | }
103 |
104 | static inline void doubleget(double *V, const uchar *M)
105 | {
106 | memcpy(V, (M), sizeof(double));
107 | }
108 |
109 | static inline void doublestore(uchar *T, double V)
110 | {
111 | memcpy((T), &V, sizeof(double));
112 | }
113 |
114 | static inline void longlongget(longlong *V, const uchar *M)
115 | {
116 | memcpy(V, (M), sizeof(ulonglong));
117 | }
118 | static inline void longlongstore(uchar *T, longlong V)
119 | {
120 | memcpy((T), &V, sizeof(ulonglong));
121 | }
122 |
--------------------------------------------------------------------------------
/vendor/mysql/include/binary_log_types.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2014, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | Without limiting anything contained in the foregoing, this file,
15 | which is part of C Driver for MySQL (Connector/C), is also subject to the
16 | Universal FOSS Exception, version 1.0, a copy of which can be found at
17 | http://oss.oracle.com/licenses/universal-foss-exception.
18 |
19 | This program is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU General Public License, version 2.0, for more details.
23 |
24 | You should have received a copy of the GNU General Public License
25 | along with this program; if not, write to the Free Software
26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
27 |
28 | /**
29 | @file binary_log_types.h
30 |
31 | @brief This file contains the field type.
32 |
33 |
34 | @note This file can be imported both from C and C++ code, so the
35 | definitions have to be constructed to support this.
36 | */
37 |
38 | #ifndef BINARY_LOG_TYPES_INCLUDED
39 | #define BINARY_LOG_TYPES_INCLUDED
40 |
41 | #ifdef __cplusplus
42 | extern "C"
43 | {
44 | #endif
45 |
46 | /*
47 | * Constants exported from this package.
48 | */
49 |
50 | typedef enum enum_field_types {
51 | MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
52 | MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG,
53 | MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE,
54 | MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP,
55 | MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24,
56 | MYSQL_TYPE_DATE, MYSQL_TYPE_TIME,
57 | MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,
58 | MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR,
59 | MYSQL_TYPE_BIT,
60 | MYSQL_TYPE_TIMESTAMP2,
61 | MYSQL_TYPE_DATETIME2,
62 | MYSQL_TYPE_TIME2,
63 | MYSQL_TYPE_JSON=245,
64 | MYSQL_TYPE_NEWDECIMAL=246,
65 | MYSQL_TYPE_ENUM=247,
66 | MYSQL_TYPE_SET=248,
67 | MYSQL_TYPE_TINY_BLOB=249,
68 | MYSQL_TYPE_MEDIUM_BLOB=250,
69 | MYSQL_TYPE_LONG_BLOB=251,
70 | MYSQL_TYPE_BLOB=252,
71 | MYSQL_TYPE_VAR_STRING=253,
72 | MYSQL_TYPE_STRING=254,
73 | MYSQL_TYPE_GEOMETRY=255
74 | } enum_field_types;
75 |
76 | #define DATETIME_MAX_DECIMALS 6
77 |
78 | #ifdef __cplusplus
79 | }
80 | #endif // __cplusplus
81 |
82 | #endif /* BINARY_LOG_TYPES_INCLUDED */
83 |
--------------------------------------------------------------------------------
/vendor/mysql/include/byte_order_generic.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2001, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | /*
24 | Endianness-independent definitions for architectures other
25 | than the x86 architecture.
26 | */
27 | static inline int16 sint2korr(const uchar *A)
28 | {
29 | return
30 | (int16) (((int16) (A[0])) +
31 | ((int16) (A[1]) << 8))
32 | ;
33 | }
34 |
35 | static inline int32 sint4korr(const uchar *A)
36 | {
37 | return
38 | (int32) (((int32) (A[0])) +
39 | (((int32) (A[1]) << 8)) +
40 | (((int32) (A[2]) << 16)) +
41 | (((int32) (A[3]) << 24)))
42 | ;
43 | }
44 |
45 | static inline uint16 uint2korr(const uchar *A)
46 | {
47 | return
48 | (uint16) (((uint16) (A[0])) +
49 | ((uint16) (A[1]) << 8))
50 | ;
51 | }
52 |
53 | static inline uint32 uint4korr(const uchar *A)
54 | {
55 | return
56 | (uint32) (((uint32) (A[0])) +
57 | (((uint32) (A[1])) << 8) +
58 | (((uint32) (A[2])) << 16) +
59 | (((uint32) (A[3])) << 24))
60 | ;
61 | }
62 |
63 | static inline ulonglong uint8korr(const uchar *A)
64 | {
65 | return
66 | ((ulonglong)(((uint32) (A[0])) +
67 | (((uint32) (A[1])) << 8) +
68 | (((uint32) (A[2])) << 16) +
69 | (((uint32) (A[3])) << 24)) +
70 | (((ulonglong) (((uint32) (A[4])) +
71 | (((uint32) (A[5])) << 8) +
72 | (((uint32) (A[6])) << 16) +
73 | (((uint32) (A[7])) << 24))) <<
74 | 32))
75 | ;
76 | }
77 |
78 | static inline longlong sint8korr(const uchar *A)
79 | {
80 | return (longlong) uint8korr(A);
81 | }
82 |
83 | static inline void int2store(uchar *T, uint16 A)
84 | {
85 | uint def_temp= A ;
86 | *(T)= (uchar)(def_temp);
87 | *(T+1)= (uchar)(def_temp >> 8);
88 | }
89 |
90 | static inline void int4store(uchar *T, uint32 A)
91 | {
92 | *(T)= (uchar) (A);
93 | *(T+1)=(uchar) (A >> 8);
94 | *(T+2)=(uchar) (A >> 16);
95 | *(T+3)=(uchar) (A >> 24);
96 | }
97 |
98 | static inline void int8store(uchar *T, ulonglong A)
99 | {
100 | uint def_temp= (uint) A,
101 | def_temp2= (uint) (A >> 32);
102 | int4store(T, def_temp);
103 | int4store(T+4,def_temp2);
104 | }
105 |
--------------------------------------------------------------------------------
/vendor/mysql/include/byte_order_generic_x86.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2001, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | Without limiting anything contained in the foregoing, this file,
15 | which is part of C Driver for MySQL (Connector/C), is also subject to the
16 | Universal FOSS Exception, version 1.0, a copy of which can be found at
17 | http://oss.oracle.com/licenses/universal-foss-exception.
18 |
19 | This program is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU General Public License, version 2.0, for more details.
23 |
24 | You should have received a copy of the GNU General Public License
25 | along with this program; if not, write to the Free Software
26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
27 |
28 | /*
29 | Optimized functions for the x86 architecture (_WIN32 included).
30 |
31 | x86 handles misaligned reads and writes just fine, so suppress
32 | UBSAN warnings for these functions.
33 | */
34 | static inline int16 sint2korr(const uchar *A) SUPPRESS_UBSAN;
35 | static inline int16 sint2korr(const uchar *A) { return *((int16*) A); }
36 |
37 | static inline int32 sint4korr(const uchar *A) SUPPRESS_UBSAN;
38 | static inline int32 sint4korr(const uchar *A) { return *((int32*) A); }
39 |
40 | static inline uint16 uint2korr(const uchar *A) SUPPRESS_UBSAN;
41 | static inline uint16 uint2korr(const uchar *A) { return *((uint16*) A); }
42 |
43 | static inline uint32 uint4korr(const uchar *A) SUPPRESS_UBSAN;
44 | static inline uint32 uint4korr(const uchar *A) { return *((uint32*) A); }
45 |
46 | static inline ulonglong uint8korr(const uchar *A) SUPPRESS_UBSAN;
47 | static inline ulonglong uint8korr(const uchar *A) { return *((ulonglong*) A);}
48 |
49 | static inline longlong sint8korr(const uchar *A) SUPPRESS_UBSAN;
50 | static inline longlong sint8korr(const uchar *A) { return *((longlong*) A); }
51 |
52 | static inline void int2store(uchar *T, uint16 A) SUPPRESS_UBSAN;
53 | static inline void int2store(uchar *T, uint16 A)
54 | {
55 | *((uint16*) T)= A;
56 | }
57 |
58 | static inline void int4store(uchar *T, uint32 A) SUPPRESS_UBSAN;
59 | static inline void int4store(uchar *T, uint32 A)
60 | {
61 | *((uint32*) T)= A;
62 | }
63 |
64 | static inline void int8store(uchar *T, ulonglong A) SUPPRESS_UBSAN;
65 | static inline void int8store(uchar *T, ulonglong A)
66 | {
67 | *((ulonglong*) T)= A;
68 | }
69 |
--------------------------------------------------------------------------------
/vendor/mysql/include/little_endian.h:
--------------------------------------------------------------------------------
1 | #ifndef LITTLE_ENDIAN_INCLUDED
2 | #define LITTLE_ENDIAN_INCLUDED
3 | /* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
4 |
5 | This program is free software; you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License, version 2.0,
7 | as published by the Free Software Foundation.
8 |
9 | This program is also distributed with certain software (including
10 | but not limited to OpenSSL) that is licensed under separate terms,
11 | as designated in a particular file or component or in included license
12 | documentation. The authors of MySQL hereby grant you an additional
13 | permission to link the program and your derivative works with the
14 | separately licensed software that they have included with MySQL.
15 |
16 | Without limiting anything contained in the foregoing, this file,
17 | which is part of C Driver for MySQL (Connector/C), is also subject to the
18 | Universal FOSS Exception, version 1.0, a copy of which can be found at
19 | http://oss.oracle.com/licenses/universal-foss-exception.
20 |
21 | This program is distributed in the hope that it will be useful,
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | GNU General Public License, version 2.0, for more details.
25 |
26 | You should have received a copy of the GNU General Public License
27 | along with this program; if not, write to the Free Software
28 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
29 |
30 | /*
31 | Data in little-endian format.
32 | */
33 |
34 | #include
35 |
36 | static inline void float4get (float *V, const uchar *M)
37 | {
38 | memcpy(V, (M), sizeof(float));
39 | }
40 |
41 | static inline void float4store(uchar *V, float M)
42 | {
43 | memcpy(V, (&M), sizeof(float));
44 | }
45 |
46 | static inline void float8get (double *V, const uchar *M)
47 | {
48 | memcpy(V, M, sizeof(double));
49 | }
50 |
51 | static inline void float8store(uchar *V, double M)
52 | {
53 | memcpy(V, &M, sizeof(double));
54 | }
55 |
56 | static inline void floatget (float *V, const uchar *M) { float4get(V, M); }
57 | static inline void floatstore (uchar *V, float M) { float4store(V, M); }
58 |
59 | /* Bi-endian hardware.... */
60 | #if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
61 | static inline void doublestore(uchar *T, double V)
62 | { *(((char*)T)+0)=(char) ((uchar *) &V)[4];
63 | *(((char*)T)+1)=(char) ((uchar *) &V)[5];
64 | *(((char*)T)+2)=(char) ((uchar *) &V)[6];
65 | *(((char*)T)+3)=(char) ((uchar *) &V)[7];
66 | *(((char*)T)+4)=(char) ((uchar *) &V)[0];
67 | *(((char*)T)+5)=(char) ((uchar *) &V)[1];
68 | *(((char*)T)+6)=(char) ((uchar *) &V)[2];
69 | *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }
70 | static inline void doubleget(double *V, const uchar *M)
71 | { double def_temp;
72 | ((uchar*) &def_temp)[0]=(M)[4];
73 | ((uchar*) &def_temp)[1]=(M)[5];
74 | ((uchar*) &def_temp)[2]=(M)[6];
75 | ((uchar*) &def_temp)[3]=(M)[7];
76 | ((uchar*) &def_temp)[4]=(M)[0];
77 | ((uchar*) &def_temp)[5]=(M)[1];
78 | ((uchar*) &def_temp)[6]=(M)[2];
79 | ((uchar*) &def_temp)[7]=(M)[3];
80 | (*V) = def_temp; }
81 |
82 | #else /* Bi-endian hardware.... */
83 |
84 | static inline void doublestore(uchar *T, double V) { memcpy(T, &V, sizeof(double)); }
85 | static inline void doubleget (double *V, const uchar *M) { memcpy(V, M, sizeof(double)); }
86 |
87 | #endif /* Bi-endian hardware.... */
88 |
89 | static inline void ushortget(uint16 *V, const uchar *pM) { *V= uint2korr(pM); }
90 | static inline void shortget (int16 *V, const uchar *pM) { *V= sint2korr(pM); }
91 | static inline void longget (int32 *V, const uchar *pM) { *V= sint4korr(pM); }
92 | static inline void ulongget (uint32 *V, const uchar *pM) { *V= uint4korr(pM); }
93 | static inline void shortstore(uchar *T, int16 V) { int2store(T, V); }
94 | static inline void longstore (uchar *T, int32 V) { int4store(T, V); }
95 |
96 | static inline void longlongget(longlong *V, const uchar *M)
97 | {
98 | memcpy(V, (M), sizeof(ulonglong));
99 | }
100 | static inline void longlongstore(uchar *T, longlong V)
101 | {
102 | memcpy((T), &V, sizeof(ulonglong));
103 | }
104 |
105 | #endif /* LITTLE_ENDIAN_INCLUDED */
106 |
--------------------------------------------------------------------------------
/vendor/mysql/include/my_alloc.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | Without limiting anything contained in the foregoing, this file,
15 | which is part of C Driver for MySQL (Connector/C), is also subject to the
16 | Universal FOSS Exception, version 1.0, a copy of which can be found at
17 | http://oss.oracle.com/licenses/universal-foss-exception.
18 |
19 | This program is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU General Public License, version 2.0, for more details.
23 |
24 | You should have received a copy of the GNU General Public License
25 | along with this program; if not, write to the Free Software
26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
27 |
28 | /*
29 | Data structures for mysys/my_alloc.c (root memory allocator)
30 | */
31 |
32 | #ifndef _my_alloc_h
33 | #define _my_alloc_h
34 |
35 | #define ALLOC_MAX_BLOCK_TO_DROP 4096
36 | #define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
37 |
38 | /* PSI_memory_key */
39 | #include "mysql/psi/psi_memory.h"
40 |
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 | typedef struct st_used_mem
46 | { /* struct for once_alloc (block) */
47 | struct st_used_mem *next; /* Next block in use */
48 | unsigned int left; /* memory left in block */
49 | unsigned int size; /* size of block */
50 | } USED_MEM;
51 |
52 |
53 | typedef struct st_mem_root
54 | {
55 | USED_MEM *free; /* blocks with free memory in it */
56 | USED_MEM *used; /* blocks almost without free memory */
57 | USED_MEM *pre_alloc; /* preallocated block */
58 | /* if block have less memory it will be put in 'used' list */
59 | size_t min_malloc;
60 | size_t block_size; /* initial block size */
61 | unsigned int block_num; /* allocated blocks counter */
62 | /*
63 | first free block in queue test counter (if it exceed
64 | MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list)
65 | */
66 | unsigned int first_block_usage;
67 |
68 | /*
69 | Maximum amount of memory this mem_root can hold. A value of 0
70 | implies there is no limit.
71 | */
72 | size_t max_capacity;
73 |
74 | /* Allocated size for this mem_root */
75 |
76 | size_t allocated_size;
77 |
78 | /* Enable this for error reporting if capacity is exceeded */
79 | my_bool error_for_capacity_exceeded;
80 |
81 | void (*error_handler)(void);
82 |
83 | PSI_memory_key m_psi_key;
84 | } MEM_ROOT;
85 |
86 | #ifdef __cplusplus
87 | }
88 | #endif
89 |
90 | #endif
91 |
--------------------------------------------------------------------------------
/vendor/mysql/include/my_command.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2015, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | Without limiting anything contained in the foregoing, this file,
15 | which is part of C Driver for MySQL (Connector/C), is also subject to the
16 | Universal FOSS Exception, version 1.0, a copy of which can be found at
17 | http://oss.oracle.com/licenses/universal-foss-exception.
18 |
19 | This program is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU General Public License, version 2.0, for more details.
23 |
24 | You should have received a copy of the GNU General Public License
25 | along with this program; if not, write to the Free Software
26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
27 |
28 | #ifndef _mysql_command_h
29 | #define _mysql_command_h
30 |
31 | /**
32 | @enum enum_server_command
33 | @brief You should add new commands to the end of this list, otherwise old
34 | servers won't be able to handle them as 'unsupported'.
35 | */
36 | enum enum_server_command
37 | {
38 | COM_SLEEP,
39 | COM_QUIT,
40 | COM_INIT_DB,
41 | COM_QUERY,
42 | COM_FIELD_LIST,
43 | COM_CREATE_DB,
44 | COM_DROP_DB,
45 | COM_REFRESH,
46 | COM_SHUTDOWN,
47 | COM_STATISTICS,
48 | COM_PROCESS_INFO,
49 | COM_CONNECT,
50 | COM_PROCESS_KILL,
51 | COM_DEBUG,
52 | COM_PING,
53 | COM_TIME,
54 | COM_DELAYED_INSERT,
55 | COM_CHANGE_USER,
56 | COM_BINLOG_DUMP,
57 | COM_TABLE_DUMP,
58 | COM_CONNECT_OUT,
59 | COM_REGISTER_SLAVE,
60 | COM_STMT_PREPARE,
61 | COM_STMT_EXECUTE,
62 | COM_STMT_SEND_LONG_DATA,
63 | COM_STMT_CLOSE,
64 | COM_STMT_RESET,
65 | COM_SET_OPTION,
66 | COM_STMT_FETCH,
67 | COM_DAEMON,
68 | COM_BINLOG_DUMP_GTID,
69 | COM_RESET_CONNECTION,
70 | /* don't forget to update const char *command_name[] in sql_parse.cc */
71 |
72 | /* Must be last */
73 | COM_END
74 | };
75 |
76 | #endif /* _mysql_command_h */
77 |
--------------------------------------------------------------------------------
/vendor/mysql/include/my_dir.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MY_DIR_H
24 | #define MY_DIR_H
25 |
26 | #include "my_global.h"
27 |
28 | #include
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /* Defines for my_dir and my_stat */
35 |
36 | #ifdef _WIN32
37 | #define S_IROTH _S_IREAD
38 | #define S_IFIFO _S_IFIFO
39 | #endif
40 |
41 | #define MY_S_IFMT S_IFMT /* type of file */
42 | #define MY_S_IFDIR S_IFDIR /* directory */
43 | #define MY_S_IFCHR S_IFCHR /* character special */
44 | #define MY_S_IFBLK S_IFBLK /* block special */
45 | #define MY_S_IFREG S_IFREG /* regular */
46 | #define MY_S_IFIFO S_IFIFO /* fifo */
47 | #define MY_S_ISUID S_ISUID /* set user id on execution */
48 | #define MY_S_ISGID S_ISGID /* set group id on execution */
49 | #define MY_S_ISVTX S_ISVTX /* save swapped text even after use */
50 | #define MY_S_IREAD S_IREAD /* read permission, owner */
51 | #define MY_S_IWRITE S_IWRITE /* write permission, owner */
52 | #define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */
53 |
54 | #define MY_S_ISDIR(m) (((m) & MY_S_IFMT) == MY_S_IFDIR)
55 | #define MY_S_ISCHR(m) (((m) & MY_S_IFMT) == MY_S_IFCHR)
56 | #define MY_S_ISBLK(m) (((m) & MY_S_IFMT) == MY_S_IFBLK)
57 | #define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG)
58 | #define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO)
59 |
60 | #define MY_DONT_SORT 512 /* my_lib; Don't sort files */
61 | #define MY_WANT_STAT 1024 /* my_lib; stat files */
62 |
63 | /* typedefs for my_dir & my_stat */
64 |
65 | #if(_MSC_VER)
66 | #define MY_STAT struct _stati64 /* 64 bit file size */
67 | #else
68 | #define MY_STAT struct stat /* Orginal struct have what we need */
69 | #endif
70 |
71 | /* Struct describing one file returned from my_dir */
72 | typedef struct fileinfo
73 | {
74 | char *name;
75 | MY_STAT *mystat;
76 | } FILEINFO;
77 |
78 | typedef struct st_my_dir /* Struct returned from my_dir */
79 | {
80 | /*
81 | These members are just copies of parts of DYNAMIC_ARRAY structure,
82 | which is allocated right after the end of MY_DIR structure (MEM_ROOT
83 | for storing names is also resides there). We've left them here because
84 | we don't want to change code that uses my_dir.
85 | */
86 | struct fileinfo *dir_entry;
87 | uint number_off_files;
88 | } MY_DIR;
89 |
90 | extern MY_DIR *my_dir(const char *path,myf MyFlags);
91 | extern void my_dirend(MY_DIR *buffer);
92 | extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags);
93 | extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags);
94 |
95 | #ifdef __cplusplus
96 | }
97 | #endif
98 |
99 | #endif /* MY_DIR_H */
100 |
101 |
--------------------------------------------------------------------------------
/vendor/mysql/include/my_list.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | Without limiting anything contained in the foregoing, this file,
15 | which is part of C Driver for MySQL (Connector/C), is also subject to the
16 | Universal FOSS Exception, version 1.0, a copy of which can be found at
17 | http://oss.oracle.com/licenses/universal-foss-exception.
18 |
19 | This program is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU General Public License, version 2.0, for more details.
23 |
24 | You should have received a copy of the GNU General Public License
25 | along with this program; if not, write to the Free Software
26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
27 |
28 | #ifndef _list_h_
29 | #define _list_h_
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | typedef struct st_list {
36 | struct st_list *prev,*next;
37 | void *data;
38 | } LIST;
39 |
40 | typedef int (*list_walk_action)(void *,void *);
41 |
42 | extern LIST *list_add(LIST *root,LIST *element);
43 | extern LIST *list_delete(LIST *root,LIST *element);
44 | extern LIST *list_cons(void *data,LIST *root);
45 | extern LIST *list_reverse(LIST *root);
46 | extern void list_free(LIST *root,unsigned int free_data);
47 | extern unsigned int list_length(LIST *);
48 | extern int list_walk(LIST *,list_walk_action action,unsigned char * argument);
49 |
50 | #define list_rest(a) ((a)->next)
51 | #define list_push(a,b) (a)=list_cons((b),(a))
52 | #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); }
53 |
54 | #ifdef __cplusplus
55 | }
56 | #endif
57 | #endif
58 |
--------------------------------------------------------------------------------
/vendor/mysql/include/my_thread_local.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
22 |
23 | #ifndef MY_THREAD_LOCAL_INCLUDED
24 | #define MY_THREAD_LOCAL_INCLUDED
25 |
26 | #ifndef _WIN32
27 | #include
28 | #endif
29 |
30 | struct _db_code_state_;
31 | typedef uint32 my_thread_id;
32 |
33 | C_MODE_START
34 |
35 | #ifdef _WIN32
36 | typedef DWORD thread_local_key_t;
37 | #else
38 | typedef pthread_key_t thread_local_key_t;
39 | #endif
40 |
41 | static inline int my_create_thread_local_key(thread_local_key_t *key,
42 | void (*destructor)(void *))
43 | {
44 | #ifdef _WIN32
45 | *key= TlsAlloc();
46 | return (*key == TLS_OUT_OF_INDEXES);
47 | #else
48 | return pthread_key_create(key, destructor);
49 | #endif
50 | }
51 |
52 | static inline int my_delete_thread_local_key(thread_local_key_t key)
53 | {
54 | #ifdef _WIN32
55 | return !TlsFree(key);
56 | #else
57 | return pthread_key_delete(key);
58 | #endif
59 | }
60 |
61 | static inline void* my_get_thread_local(thread_local_key_t key)
62 | {
63 | #ifdef _WIN32
64 | return TlsGetValue(key);
65 | #else
66 | return pthread_getspecific(key);
67 | #endif
68 | }
69 |
70 | static inline int my_set_thread_local(thread_local_key_t key,
71 | void *value)
72 | {
73 | #ifdef _WIN32
74 | return !TlsSetValue(key, value);
75 | #else
76 | return pthread_setspecific(key, value);
77 | #endif
78 | }
79 |
80 | /**
81 | Retrieve the MySQL thread-local storage variant of errno.
82 | */
83 | int my_errno();
84 |
85 | /**
86 | Set the MySQL thread-local storage variant of errno.
87 | */
88 | void set_my_errno(int my_errno);
89 |
90 | #ifdef _WIN32
91 | /*
92 | thr_winerr is used for returning the original OS error-code in Windows,
93 | my_osmaperr() returns EINVAL for all unknown Windows errors, hence we
94 | preserve the original Windows Error code in thr_winerr.
95 | */
96 | int thr_winerr();
97 |
98 | void set_thr_winerr(int winerr);
99 |
100 | #endif
101 |
102 | #ifndef NDEBUG
103 | /* Return pointer to DBUG for holding current state */
104 | struct _db_code_state_ **my_thread_var_dbug();
105 |
106 | my_thread_id my_thread_var_id();
107 |
108 | void set_my_thread_var_id(my_thread_id id);
109 |
110 | #endif
111 |
112 | C_MODE_END
113 |
114 | #endif // MY_THREAD_LOCAL_INCLUDED
115 |
--------------------------------------------------------------------------------
/vendor/mysql/include/my_xml.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
22 |
23 |
24 | #ifndef _my_xml_h
25 | #define _my_xml_h
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 |
32 | #define MY_XML_OK 0
33 | #define MY_XML_ERROR 1
34 |
35 | /*
36 | A flag whether to use absolute tag names in call-back functions,
37 | like "a", "a.b" and "a.b.c" (used in character set file parser),
38 | or relative names like "a", "b" and "c".
39 | */
40 | #define MY_XML_FLAG_RELATIVE_NAMES 1
41 |
42 | /*
43 | A flag whether to skip normilization of text values before calling
44 | call-back functions: i.e. skip leading/trailing spaces,
45 | \r, \n, \t characters.
46 | */
47 | #define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2
48 |
49 | enum my_xml_node_type
50 | {
51 | MY_XML_NODE_TAG, /* can have TAG, ATTR and TEXT children */
52 | MY_XML_NODE_ATTR, /* can have TEXT children */
53 | MY_XML_NODE_TEXT /* cannot have children */
54 | };
55 |
56 | typedef struct xml_stack_st
57 | {
58 | int flags;
59 | enum my_xml_node_type current_node_type;
60 | char errstr[128];
61 |
62 | struct {
63 | char static_buffer[128];
64 | char *buffer;
65 | size_t buffer_size;
66 | char *start;
67 | char *end;
68 | } attr;
69 |
70 | const char *beg;
71 | const char *cur;
72 | const char *end;
73 | void *user_data;
74 | int (*enter)(struct xml_stack_st *st,const char *val, size_t len);
75 | int (*value)(struct xml_stack_st *st,const char *val, size_t len);
76 | int (*leave_xml)(struct xml_stack_st *st,const char *val, size_t len);
77 | } MY_XML_PARSER;
78 |
79 | void my_xml_parser_create(MY_XML_PARSER *st);
80 | void my_xml_parser_free(MY_XML_PARSER *st);
81 | int my_xml_parse(MY_XML_PARSER *st,const char *str, size_t len);
82 |
83 | void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
84 | const char *,
85 | size_t len));
86 | void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
87 | const char *,
88 | size_t len));
89 | void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
90 | const char *,
91 | size_t len));
92 | void my_xml_set_user_data(MY_XML_PARSER *st, void *);
93 |
94 | size_t my_xml_error_pos(MY_XML_PARSER *st);
95 | uint my_xml_error_lineno(MY_XML_PARSER *st);
96 |
97 | const char *my_xml_error_string(MY_XML_PARSER *st);
98 |
99 | #ifdef __cplusplus
100 | }
101 | #endif
102 |
103 | #endif /* _my_xml_h */
104 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/client_authentication.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 | #ifndef CLIENT_AUTHENTICATION_H
23 | #define CLIENT_AUTHENTICATION_H
24 | #include
25 | #include "mysql.h"
26 | #include "mysql/client_plugin.h"
27 |
28 | C_MODE_START
29 | int sha256_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
30 | int sha256_password_init(char *, size_t, int, va_list);
31 | int sha256_password_deinit(void);
32 | int caching_sha2_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
33 | int caching_sha2_password_init(char *, size_t, int, va_list);
34 | int caching_sha2_password_deinit(void);
35 | C_MODE_END
36 |
37 | #endif
38 |
39 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/client_plugin.h.pp:
--------------------------------------------------------------------------------
1 | struct st_mysql_client_plugin
2 | {
3 | int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(void); int (*options)(const char *option, const void *);
4 | };
5 | struct st_mysql;
6 | #include "plugin_auth_common.h"
7 | typedef struct st_plugin_vio_info
8 | {
9 | enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET,
10 | MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol;
11 | int socket;
12 | } MYSQL_PLUGIN_VIO_INFO;
13 | typedef struct st_plugin_vio
14 | {
15 | int (*read_packet)(struct st_plugin_vio *vio,
16 | unsigned char **buf);
17 | int (*write_packet)(struct st_plugin_vio *vio,
18 | const unsigned char *packet,
19 | int packet_len);
20 | void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info);
21 | } MYSQL_PLUGIN_VIO;
22 | struct st_mysql_client_plugin_AUTHENTICATION
23 | {
24 | int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(void); int (*options)(const char *option, const void *);
25 | int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql);
26 | };
27 | struct st_mysql_client_plugin *
28 | mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
29 | int argc, ...);
30 | struct st_mysql_client_plugin *
31 | mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type,
32 | int argc, va_list args);
33 | struct st_mysql_client_plugin *
34 | mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type);
35 | struct st_mysql_client_plugin *
36 | mysql_client_register_plugin(struct st_mysql *mysql,
37 | struct st_mysql_client_plugin *plugin);
38 | int mysql_plugin_options(struct st_mysql_client_plugin *plugin,
39 | const char *option, const void *value);
40 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/com_data.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2015, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License along
20 | with this program; if not, write to the Free Software Foundation, Inc., 51
21 | Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 | #ifndef PLUGIN_PROTOCOL_INCLUDED
23 | #define PLUGIN_PROTOCOL_INCLUDED
24 |
25 | #ifndef MYSQL_ABI_CHECK
26 | #include "my_global.h" /* Needed for my_bool in mysql_com.h */
27 | #include "mysql_com.h" /* mysql_enum_shutdown_level */
28 | #endif
29 |
30 |
31 | /**
32 | @file
33 | Definition of COM_DATA to be used with the Command service as data input
34 | structure.
35 | */
36 |
37 |
38 | typedef struct st_com_init_db_data
39 | {
40 | const char *db_name;
41 | unsigned long length;
42 | } COM_INIT_DB_DATA;
43 |
44 | typedef struct st_com_refresh_data
45 | {
46 | unsigned char options;
47 | } COM_REFRESH_DATA;
48 |
49 | typedef struct st_com_shutdown_data
50 | {
51 | enum mysql_enum_shutdown_level level;
52 | } COM_SHUTDOWN_DATA;
53 |
54 | typedef struct st_com_kill_data
55 | {
56 | unsigned long id;
57 | } COM_KILL_DATA;
58 |
59 | typedef struct st_com_set_option_data
60 | {
61 | unsigned int opt_command;
62 | } COM_SET_OPTION_DATA;
63 |
64 | typedef struct st_com_stmt_execute_data
65 | {
66 | unsigned long stmt_id;
67 | unsigned long flags;
68 | unsigned char *params;
69 | unsigned long params_length;
70 | } COM_STMT_EXECUTE_DATA;
71 |
72 | typedef struct st_com_stmt_fetch_data
73 | {
74 | unsigned long stmt_id;
75 | unsigned long num_rows;
76 | } COM_STMT_FETCH_DATA;
77 |
78 | typedef struct st_com_stmt_send_long_data_data
79 | {
80 | unsigned long stmt_id;
81 | unsigned int param_number;
82 | unsigned char *longdata;
83 | unsigned long length;
84 | } COM_STMT_SEND_LONG_DATA_DATA;
85 |
86 | typedef struct st_com_stmt_prepare_data
87 | {
88 | const char *query;
89 | unsigned int length;
90 | } COM_STMT_PREPARE_DATA;
91 |
92 | typedef struct st_stmt_close_data
93 | {
94 | unsigned int stmt_id;
95 | } COM_STMT_CLOSE_DATA;
96 |
97 | typedef struct st_com_stmt_reset_data
98 | {
99 | unsigned int stmt_id;
100 | } COM_STMT_RESET_DATA;
101 |
102 | typedef struct st_com_query_data
103 | {
104 | const char *query;
105 | unsigned int length;
106 | } COM_QUERY_DATA;
107 |
108 | typedef struct st_com_field_list_data
109 | {
110 | unsigned char *table_name;
111 | unsigned int table_name_length;
112 | const unsigned char *query;
113 | unsigned int query_length;
114 | } COM_FIELD_LIST_DATA;
115 |
116 | union COM_DATA {
117 | COM_INIT_DB_DATA com_init_db;
118 | COM_REFRESH_DATA com_refresh;
119 | COM_SHUTDOWN_DATA com_shutdown;
120 | COM_KILL_DATA com_kill;
121 | COM_SET_OPTION_DATA com_set_option;
122 | COM_STMT_EXECUTE_DATA com_stmt_execute;
123 | COM_STMT_FETCH_DATA com_stmt_fetch;
124 | COM_STMT_SEND_LONG_DATA_DATA com_stmt_send_long_data;
125 | COM_STMT_PREPARE_DATA com_stmt_prepare;
126 | COM_STMT_CLOSE_DATA com_stmt_close;
127 | COM_STMT_RESET_DATA com_stmt_reset;
128 | COM_QUERY_DATA com_query;
129 | COM_FIELD_LIST_DATA com_field_list;
130 | };
131 |
132 | #endif /* PLUGIN_PROTOCOL_INCLUDED */
133 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/get_password.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | /*
24 | ** Ask for a password from tty
25 | ** This is an own file to avoid conflicts with curses
26 | */
27 |
28 | #ifndef MYSQL_GET_PASSWORD_H_INCLUDED
29 | #define MYSQL_GET_PASSWORD_H_INCLUDED
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | typedef char *(* strdup_handler_t)(const char *, int);
36 | char *get_tty_password_ext(const char *opt_message,
37 | strdup_handler_t strdup_function);
38 |
39 | #ifdef __cplusplus
40 | }
41 | #endif
42 |
43 | #endif /* ! MYSQL_GET_PASSWORD_H_INCLUDED */
44 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/innodb_priv.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
22 |
23 | #ifndef INNODB_PRIV_INCLUDED
24 | #define INNODB_PRIV_INCLUDED
25 |
26 | /** @file Declaring server-internal functions that are used by InnoDB. */
27 |
28 | class THD;
29 |
30 | int get_quote_char_for_identifier(THD *thd, const char *name, size_t length);
31 | bool schema_table_store_record(THD *thd, TABLE *table);
32 | void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
33 | bool check_global_access(THD *thd, ulong want_access);
34 | size_t strconvert(CHARSET_INFO *from_cs, const char *from,
35 | CHARSET_INFO *to_cs, char *to, size_t to_length,
36 | uint *errors);
37 | void sql_print_error(const char *format, ...);
38 |
39 | /**
40 | Store record to I_S table, convert HEAP table to InnoDB table if necessary.
41 |
42 | @param[in] thd thread handler
43 | @param[in] table Information schema table to be updated
44 | @param[in] make_ondisk if true, convert heap table to on disk table.
45 | default value is true.
46 | @return 0 on success
47 | @return error code on failure.
48 | */
49 | int schema_table_store_record2(THD *thd, TABLE *table, bool make_ondisk);
50 |
51 | /**
52 | Convert HEAP table to InnoDB table if necessary
53 |
54 | @param[in] thd thread handler
55 | @param[in] table Information schema table to be converted.
56 | @param[in] error the error code returned previously.
57 | @return false on success, true on error.
58 | */
59 | bool convert_heap_table_to_ondisk(THD *thd, TABLE *table, int error);
60 |
61 |
62 | #endif /* INNODB_PRIV_INCLUDED */
63 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/mysql_lex_string.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2015, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_LEX_STRING_INCLUDED
24 | #define MYSQL_LEX_STRING_INCLUDED
25 |
26 | struct st_mysql_lex_string
27 | {
28 | char *str;
29 | size_t length;
30 | };
31 | typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
32 |
33 | struct st_mysql_const_lex_string
34 | {
35 | const char *str;
36 | size_t length;
37 | };
38 | typedef struct st_mysql_const_lex_string MYSQL_LEX_CSTRING;
39 |
40 | #endif // MYSQL_LEX_STRING_INCLUDED
41 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/plugin_keyring.h.pp:
--------------------------------------------------------------------------------
1 | #include "plugin.h"
2 | typedef void * MYSQL_PLUGIN;
3 | struct st_mysql_xid {
4 | long formatID;
5 | long gtrid_length;
6 | long bqual_length;
7 | char data[128];
8 | };
9 | typedef struct st_mysql_xid MYSQL_XID;
10 | enum enum_mysql_show_type
11 | {
12 | SHOW_UNDEF, SHOW_BOOL,
13 | SHOW_INT,
14 | SHOW_LONG,
15 | SHOW_LONGLONG,
16 | SHOW_CHAR, SHOW_CHAR_PTR,
17 | SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE
18 | };
19 | enum enum_mysql_show_scope
20 | {
21 | SHOW_SCOPE_UNDEF,
22 | SHOW_SCOPE_GLOBAL
23 | };
24 | struct st_mysql_show_var
25 | {
26 | const char *name;
27 | char *value;
28 | enum enum_mysql_show_type type;
29 | enum enum_mysql_show_scope scope;
30 | };
31 | typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *);
32 | struct st_mysql_sys_var;
33 | struct st_mysql_value;
34 | typedef int (*mysql_var_check_func)(void* thd,
35 | struct st_mysql_sys_var *var,
36 | void *save, struct st_mysql_value *value);
37 | typedef void (*mysql_var_update_func)(void* thd,
38 | struct st_mysql_sys_var *var,
39 | void *var_ptr, const void *save);
40 | struct st_mysql_plugin
41 | {
42 | int type;
43 | void *info;
44 | const char *name;
45 | const char *author;
46 | const char *descr;
47 | int license;
48 | int (*init)(MYSQL_PLUGIN);
49 | int (*deinit)(MYSQL_PLUGIN);
50 | unsigned int version;
51 | struct st_mysql_show_var *status_vars;
52 | struct st_mysql_sys_var **system_vars;
53 | void * __reserved1;
54 | unsigned long flags;
55 | };
56 | struct st_mysql_daemon
57 | {
58 | int interface_version;
59 | };
60 | struct st_mysql_information_schema
61 | {
62 | int interface_version;
63 | };
64 | struct st_mysql_storage_engine
65 | {
66 | int interface_version;
67 | };
68 | struct handlerton;
69 | struct Mysql_replication {
70 | int interface_version;
71 | };
72 | struct st_mysql_value
73 | {
74 | int (*value_type)(struct st_mysql_value *);
75 | const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
76 | int (*val_real)(struct st_mysql_value *, double *realbuf);
77 | int (*val_int)(struct st_mysql_value *, long long *intbuf);
78 | int (*is_unsigned)(struct st_mysql_value *);
79 | };
80 | int thd_in_lock_tables(const void* thd);
81 | int thd_tablespace_op(const void* thd);
82 | long long thd_test_options(const void* thd, long long test_options);
83 | int thd_sql_command(const void* thd);
84 | const char *set_thd_proc_info(void* thd, const char *info,
85 | const char *calling_func,
86 | const char *calling_file,
87 | const unsigned int calling_line);
88 | void **thd_ha_data(const void* thd, const struct handlerton *hton);
89 | void thd_storage_lock_wait(void* thd, long long value);
90 | int thd_tx_isolation(const void* thd);
91 | int thd_tx_is_read_only(const void* thd);
92 | void* thd_tx_arbitrate(void* requestor, void* holder);
93 | int thd_tx_priority(const void* thd);
94 | int thd_tx_is_dd_trx(const void* thd);
95 | char *thd_security_context(void* thd, char *buffer, size_t length,
96 | size_t max_query_len);
97 | void thd_inc_row_count(void* thd);
98 | int thd_allow_batch(void* thd);
99 | void thd_mark_transaction_to_rollback(void* thd, int all);
100 | int mysql_tmpfile(const char *prefix);
101 | int thd_killed(const void* thd);
102 | void thd_set_kill_status(const void* thd);
103 | void thd_binlog_pos(const void* thd,
104 | const char **file_var,
105 | unsigned long long *pos_var);
106 | unsigned long thd_get_thread_id(const void* thd);
107 | void thd_get_xid(const void* thd, MYSQL_XID *xid);
108 | void mysql_query_cache_invalidate4(void* thd,
109 | const char *key, unsigned int key_length,
110 | int using_trx);
111 | void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
112 | void thd_set_ha_data(void* thd, const struct handlerton *hton,
113 | const void *ha_data);
114 | struct st_mysql_keyring
115 | {
116 | int interface_version;
117 | my_bool (*mysql_key_store)(const char *key_id, const char *key_type,
118 | const char* user_id, const void *key, size_t key_len);
119 | my_bool (*mysql_key_fetch)(const char *key_id, char **key_type,
120 | const char *user_id, void **key, size_t *key_len);
121 | my_bool (*mysql_key_remove)(const char *key_id, const char *user_id);
122 | my_bool (*mysql_key_generate)(const char *key_id, const char *key_type,
123 | const char *user_id, size_t key_len);
124 | void (*mysql_key_iterator_init)(void** key_iterator);
125 | void (*mysql_key_iterator_deinit)(void* key_iterator);
126 | bool (*mysql_key_iterator_get_key)(void* key_iterator, char *key_id, char *user_id);
127 | };
128 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/plugin_validate_password.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED
24 | #define MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED
25 |
26 | /* API for validate_password plugin. (MYSQL_VALIDATE_PASSWORD_PLUGIN) */
27 |
28 | #include
29 | #define MYSQL_VALIDATE_PASSWORD_INTERFACE_VERSION 0x0100
30 |
31 | /*
32 | The descriptor structure for the plugin, that is referred from
33 | st_mysql_plugin.
34 | */
35 |
36 | typedef void* mysql_string_handle;
37 |
38 | struct st_mysql_validate_password
39 | {
40 | int interface_version;
41 | /*
42 | This function retuns TRUE for passwords which satisfy the password
43 | policy (as choosen by plugin variable) and FALSE for all other
44 | password
45 | */
46 | int (*validate_password)(mysql_string_handle password);
47 | /*
48 | This function returns the password strength (0-100) depending
49 | upon the policies
50 | */
51 | int (*get_password_strength)(mysql_string_handle password);
52 | };
53 | #endif
54 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/psi/mysql_idle.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2011, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software Foundation,
21 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
22 |
23 | #ifndef MYSQL_IDLE_H
24 | #define MYSQL_IDLE_H
25 |
26 | /**
27 | @file mysql/psi/mysql_idle.h
28 | Instrumentation helpers for idle waits.
29 | */
30 |
31 | #include "mysql/psi/psi.h"
32 |
33 | #ifndef PSI_IDLE_CALL
34 | #define PSI_IDLE_CALL(M) PSI_DYNAMIC_CALL(M)
35 | #endif
36 |
37 | /**
38 | @defgroup Idle_instrumentation Idle Instrumentation
39 | @ingroup Instrumentation_interface
40 | @{
41 | */
42 |
43 | /**
44 | @def MYSQL_START_IDLE_WAIT
45 | Instrumentation helper for table io_waits.
46 | This instrumentation marks the start of a wait event.
47 | @param LOCKER the locker
48 | @param STATE the locker state
49 | @sa MYSQL_END_IDLE_WAIT.
50 | */
51 | #ifdef HAVE_PSI_IDLE_INTERFACE
52 | #define MYSQL_START_IDLE_WAIT(LOCKER, STATE) \
53 | LOCKER= inline_mysql_start_idle_wait(STATE, __FILE__, __LINE__)
54 | #else
55 | #define MYSQL_START_IDLE_WAIT(LOCKER, STATE) \
56 | do {} while (0)
57 | #endif
58 |
59 | /**
60 | @def MYSQL_END_IDLE_WAIT
61 | Instrumentation helper for idle waits.
62 | This instrumentation marks the end of a wait event.
63 | @param LOCKER the locker
64 | @sa MYSQL_START_IDLE_WAIT.
65 | */
66 | #ifdef HAVE_PSI_IDLE_INTERFACE
67 | #define MYSQL_END_IDLE_WAIT(LOCKER) \
68 | inline_mysql_end_idle_wait(LOCKER)
69 | #else
70 | #define MYSQL_END_IDLE_WAIT(LOCKER) \
71 | do {} while (0)
72 | #endif
73 |
74 | #ifdef HAVE_PSI_IDLE_INTERFACE
75 | /**
76 | Instrumentation calls for MYSQL_START_IDLE_WAIT.
77 | @sa MYSQL_END_IDLE_WAIT.
78 | */
79 | static inline struct PSI_idle_locker *
80 | inline_mysql_start_idle_wait(PSI_idle_locker_state *state,
81 | const char *src_file, int src_line)
82 | {
83 | struct PSI_idle_locker *locker;
84 | locker= PSI_IDLE_CALL(start_idle_wait)(state, src_file, src_line);
85 | return locker;
86 | }
87 |
88 | /**
89 | Instrumentation calls for MYSQL_END_IDLE_WAIT.
90 | @sa MYSQL_START_IDLE_WAIT.
91 | */
92 | static inline void
93 | inline_mysql_end_idle_wait(struct PSI_idle_locker *locker)
94 | {
95 | if (likely(locker != NULL))
96 | PSI_IDLE_CALL(end_idle_wait)(locker);
97 | }
98 | #endif
99 |
100 | /** @} (end of group Idle_instrumentation) */
101 |
102 | #endif
103 |
104 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/psi/mysql_mdl.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software Foundation,
21 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
22 |
23 | #ifndef MYSQL_MDL_H
24 | #define MYSQL_MDL_H
25 |
26 | /**
27 | @file mysql/psi/mysql_mdl.h
28 | Instrumentation helpers for metadata locks.
29 | */
30 |
31 | #include "mysql/psi/psi.h"
32 |
33 | #ifndef PSI_METADATA_CALL
34 | #define PSI_METADATA_CALL(M) PSI_DYNAMIC_CALL(M)
35 | #endif
36 |
37 | /**
38 | @defgroup Thread_instrumentation Metadata Instrumentation
39 | @ingroup Instrumentation_interface
40 | @{
41 | */
42 |
43 | /**
44 | @def mysql_mdl_create(K, M, A)
45 | Instrumented metadata lock creation.
46 | @param I Metadata lock identity
47 | @param K Metadata key
48 | @param T Metadata lock type
49 | @param D Metadata lock duration
50 | @param S Metadata lock status
51 | @param F request source file
52 | @param L request source line
53 | */
54 |
55 | #ifdef HAVE_PSI_METADATA_INTERFACE
56 | #define mysql_mdl_create(I, K, T, D, S, F, L) \
57 | inline_mysql_mdl_create(I, K, T, D, S, F, L)
58 | #else
59 | #define mysql_mdl_create(I, K, T, D, S, F, L) NULL
60 | #endif
61 |
62 | #ifdef HAVE_PSI_METADATA_INTERFACE
63 | #define mysql_mdl_set_status(L, S) \
64 | inline_mysql_mdl_set_status(L, S)
65 | #else
66 | #define mysql_mdl_set_status(L, S) \
67 | do {} while (0)
68 | #endif
69 |
70 |
71 | /**
72 | @def mysql_mdl_destroy(M)
73 | Instrumented metadata lock destruction.
74 | @param M Metadata lock
75 | */
76 | #ifdef HAVE_PSI_METADATA_INTERFACE
77 | #define mysql_mdl_destroy(M) \
78 | inline_mysql_mdl_destroy(M, __FILE__, __LINE__)
79 | #else
80 | #define mysql_mdl_destroy(M) \
81 | do {} while (0)
82 | #endif
83 |
84 | #ifdef HAVE_PSI_METADATA_INTERFACE
85 |
86 | static inline PSI_metadata_lock *
87 | inline_mysql_mdl_create(void *identity,
88 | const MDL_key *mdl_key,
89 | enum_mdl_type mdl_type,
90 | enum_mdl_duration mdl_duration,
91 | MDL_ticket::enum_psi_status mdl_status,
92 | const char *src_file, uint src_line)
93 | {
94 | PSI_metadata_lock *result;
95 |
96 | /* static_cast: Fit a round C++ enum peg into a square C int hole ... */
97 | result= PSI_METADATA_CALL(create_metadata_lock)
98 | (identity,
99 | mdl_key,
100 | static_cast (mdl_type),
101 | static_cast (mdl_duration),
102 | static_cast (mdl_status),
103 | src_file, src_line);
104 |
105 | return result;
106 | }
107 |
108 | static inline void inline_mysql_mdl_set_status(
109 | PSI_metadata_lock *psi,
110 | MDL_ticket::enum_psi_status mdl_status)
111 | {
112 | if (psi != NULL)
113 | PSI_METADATA_CALL(set_metadata_lock_status)(psi, mdl_status);
114 | }
115 |
116 | static inline void inline_mysql_mdl_destroy(
117 | PSI_metadata_lock *psi,
118 | const char *src_file, uint src_line)
119 | {
120 | if (psi != NULL)
121 | PSI_METADATA_CALL(destroy_metadata_lock)(psi);
122 | }
123 | #endif /* HAVE_PSI_METADATA_INTERFACE */
124 |
125 | /** @} (end of group Metadata_instrumentation) */
126 |
127 | #endif
128 |
129 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/psi/mysql_memory.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software Foundation,
21 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
22 |
23 | #ifndef MYSQL_MEMORY_H
24 | #define MYSQL_MEMORY_H
25 |
26 | /**
27 | @file mysql/psi/mysql_memory.h
28 | Instrumentation helpers for memory allocation.
29 | */
30 |
31 | #include "mysql/psi/psi.h"
32 |
33 | #ifndef PSI_MEMORY_CALL
34 | #define PSI_MEMORY_CALL(M) PSI_DYNAMIC_CALL(M)
35 | #endif
36 |
37 | /**
38 | @defgroup Memory_instrumentation Memory Instrumentation
39 | @ingroup Instrumentation_interface
40 | @{
41 | */
42 |
43 | /**
44 | @def mysql_memory_register(P1, P2, P3)
45 | Memory registration.
46 | */
47 | #define mysql_memory_register(P1, P2, P3) \
48 | inline_mysql_memory_register(P1, P2, P3)
49 |
50 | static inline void inline_mysql_memory_register(
51 | #ifdef HAVE_PSI_MEMORY_INTERFACE
52 | const char *category,
53 | PSI_memory_info *info,
54 | int count)
55 | #else
56 | const char *category MY_ATTRIBUTE((unused)),
57 | void *info MY_ATTRIBUTE((unused)),
58 | int count MY_ATTRIBUTE((unused)))
59 | #endif
60 | {
61 | #ifdef HAVE_PSI_MEMORY_INTERFACE
62 | PSI_MEMORY_CALL(register_memory)(category, info, count);
63 | #endif
64 | }
65 |
66 | /** @} (end of group Memory_instrumentation) */
67 |
68 | #endif
69 |
70 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/psi/mysql_ps.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2014, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_PS_H
24 | #define MYSQL_PS_H
25 |
26 | /**
27 | @file mysql/psi/mysql_ps.h
28 | Instrumentation helpers for prepared statements.
29 | */
30 |
31 | #include "mysql/psi/psi.h"
32 |
33 | #ifndef PSI_PS_CALL
34 | #define PSI_PS_CALL(M) PSI_DYNAMIC_CALL(M)
35 | #endif
36 |
37 | #ifdef HAVE_PSI_PS_INTERFACE
38 | #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \
39 | inline_mysql_create_prepared_stmt(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH)
40 | #define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \
41 | inline_mysql_execute_prepared_stmt(LOCKER, PREPARED_STMT)
42 | #define MYSQL_DESTROY_PS(PREPARED_STMT) \
43 | inline_mysql_destroy_prepared_stmt(PREPARED_STMT)
44 | #define MYSQL_REPREPARE_PS(PREPARED_STMT) \
45 | inline_mysql_reprepare_prepared_stmt(PREPARED_STMT)
46 | #define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \
47 | inline_mysql_set_prepared_stmt_text(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH)
48 | #else
49 | #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \
50 | NULL
51 | #define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \
52 | do {} while (0)
53 | #define MYSQL_DESTROY_PS(PREPARED_STMT) \
54 | do {} while (0)
55 | #define MYSQL_REPREPARE_PS(PREPARED_STMT) \
56 | do {} while (0)
57 | #define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \
58 | do {} while (0)
59 | #endif
60 |
61 | #ifdef HAVE_PSI_PS_INTERFACE
62 | static inline struct PSI_prepared_stmt*
63 | inline_mysql_create_prepared_stmt(void *identity, uint stmt_id,
64 | PSI_statement_locker *locker,
65 | const char *stmt_name, size_t stmt_name_length,
66 | const char *sqltext, size_t sqltext_length)
67 | {
68 | if (locker == NULL)
69 | return NULL;
70 | return PSI_PS_CALL(create_prepared_stmt)(identity, stmt_id,
71 | locker,
72 | stmt_name, stmt_name_length,
73 | sqltext, sqltext_length);
74 | }
75 |
76 | static inline void
77 | inline_mysql_execute_prepared_stmt(PSI_statement_locker *locker,
78 | PSI_prepared_stmt* prepared_stmt)
79 | {
80 | if (prepared_stmt != NULL && locker != NULL)
81 | PSI_PS_CALL(execute_prepared_stmt)(locker, prepared_stmt);
82 | }
83 |
84 | static inline void
85 | inline_mysql_destroy_prepared_stmt(PSI_prepared_stmt *prepared_stmt)
86 | {
87 | if (prepared_stmt != NULL)
88 | PSI_PS_CALL(destroy_prepared_stmt)(prepared_stmt);
89 | }
90 |
91 | static inline void
92 | inline_mysql_reprepare_prepared_stmt(PSI_prepared_stmt *prepared_stmt)
93 | {
94 | if (prepared_stmt != NULL)
95 | PSI_PS_CALL(reprepare_prepared_stmt)(prepared_stmt);
96 | }
97 |
98 | static inline void
99 | inline_mysql_set_prepared_stmt_text(PSI_prepared_stmt *prepared_stmt,
100 | const char *text,
101 | uint text_len)
102 | {
103 | if (prepared_stmt != NULL)
104 | {
105 | PSI_PS_CALL(set_prepared_stmt_text)(prepared_stmt, text, text_len);
106 | }
107 | }
108 | #endif
109 |
110 | #endif
111 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/psi/mysql_sp.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2013, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_SP_H
24 | #define MYSQL_SP_H
25 |
26 | /**
27 | @file mysql/psi/mysql_sp.h
28 | Instrumentation helpers for stored programs.
29 | */
30 |
31 | #include "mysql/psi/psi.h"
32 |
33 | #ifndef PSI_SP_CALL
34 | #define PSI_SP_CALL(M) PSI_DYNAMIC_CALL(M)
35 | #endif
36 |
37 | #ifdef HAVE_PSI_SP_INTERFACE
38 | #define MYSQL_START_SP(STATE, SP_SHARE) \
39 | inline_mysql_start_sp(STATE, SP_SHARE)
40 | #else
41 | #define MYSQL_START_SP(STATE, SP_SHARE) \
42 | NULL
43 | #endif
44 |
45 |
46 | #ifdef HAVE_PSI_SP_INTERFACE
47 | #define MYSQL_END_SP(LOCKER) \
48 | inline_mysql_end_sp(LOCKER)
49 | #else
50 | #define MYSQL_END_SP(LOCKER) \
51 | do {} while (0)
52 | #endif
53 |
54 | #ifdef HAVE_PSI_SP_INTERFACE
55 | #define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \
56 | inline_mysql_drop_sp(OT, SN, SNL, ON, ONL)
57 | #else
58 | #define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \
59 | do {} while (0)
60 | #endif
61 |
62 | #ifdef HAVE_PSI_SP_INTERFACE
63 | #define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \
64 | inline_mysql_get_sp_share(OT, SN, SNL, ON, ONL)
65 | #else
66 | #define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \
67 | NULL
68 | #endif
69 |
70 | #ifdef HAVE_PSI_SP_INTERFACE
71 | static inline struct PSI_sp_locker*
72 | inline_mysql_start_sp(PSI_sp_locker_state *state, PSI_sp_share *sp_share)
73 | {
74 | return PSI_SP_CALL(start_sp)(state, sp_share);
75 | }
76 |
77 | static inline void inline_mysql_end_sp(PSI_sp_locker *locker)
78 | {
79 | if (likely(locker != NULL))
80 | PSI_SP_CALL(end_sp)(locker);
81 | }
82 |
83 | static inline void
84 | inline_mysql_drop_sp(uint sp_type,
85 | const char* schema_name, uint shcema_name_length,
86 | const char* object_name, uint object_name_length)
87 | {
88 | PSI_SP_CALL(drop_sp)(sp_type,
89 | schema_name, shcema_name_length,
90 | object_name, object_name_length);
91 | }
92 |
93 | static inline PSI_sp_share*
94 | inline_mysql_get_sp_share(uint sp_type,
95 | const char* schema_name, uint shcema_name_length,
96 | const char* object_name, uint object_name_length)
97 | {
98 | return PSI_SP_CALL(get_sp_share)(sp_type,
99 | schema_name, shcema_name_length,
100 | object_name, object_name_length);
101 | }
102 | #endif
103 |
104 | #endif
105 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/psi/mysql_table.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software Foundation,
21 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
22 |
23 | #ifndef MYSQL_TABLE_H
24 | #define MYSQL_TABLE_H
25 |
26 | /**
27 | @file mysql/psi/mysql_table.h
28 | Instrumentation helpers for table io.
29 | */
30 |
31 | #include "mysql/psi/psi.h"
32 |
33 | #ifndef PSI_TABLE_CALL
34 | #define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M)
35 | #endif
36 |
37 | /**
38 | @defgroup Table_instrumentation Table Instrumentation
39 | @ingroup Instrumentation_interface
40 | @{
41 | */
42 |
43 | /**
44 | @def MYSQL_TABLE_WAIT_VARIABLES
45 | Instrumentation helper for table waits.
46 | This instrumentation declares local variables.
47 | Do not use a ';' after this macro
48 | @param LOCKER the locker
49 | @param STATE the locker state
50 | @sa MYSQL_START_TABLE_IO_WAIT.
51 | @sa MYSQL_END_TABLE_IO_WAIT.
52 | @sa MYSQL_START_TABLE_LOCK_WAIT.
53 | @sa MYSQL_END_TABLE_LOCK_WAIT.
54 | */
55 | #ifdef HAVE_PSI_TABLE_INTERFACE
56 | #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) \
57 | struct PSI_table_locker* LOCKER; \
58 | PSI_table_locker_state STATE;
59 | #else
60 | #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE)
61 | #endif
62 |
63 | /**
64 | @def MYSQL_START_TABLE_LOCK_WAIT
65 | Instrumentation helper for table lock waits.
66 | This instrumentation marks the start of a wait event.
67 | @param LOCKER the locker
68 | @param STATE the locker state
69 | @param PSI the instrumented table
70 | @param OP the table operation to be performed
71 | @param FLAGS per table operation flags.
72 | @sa MYSQL_END_TABLE_LOCK_WAIT.
73 | */
74 | #ifdef HAVE_PSI_TABLE_INTERFACE
75 | #define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
76 | LOCKER= inline_mysql_start_table_lock_wait(STATE, PSI, \
77 | OP, FLAGS, __FILE__, __LINE__)
78 | #else
79 | #define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
80 | do {} while (0)
81 | #endif
82 |
83 | /**
84 | @def MYSQL_END_TABLE_LOCK_WAIT
85 | Instrumentation helper for table lock waits.
86 | This instrumentation marks the end of a wait event.
87 | @param LOCKER the locker
88 | @sa MYSQL_START_TABLE_LOCK_WAIT.
89 | */
90 | #ifdef HAVE_PSI_TABLE_INTERFACE
91 | #define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
92 | inline_mysql_end_table_lock_wait(LOCKER)
93 | #else
94 | #define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
95 | do {} while (0)
96 | #endif
97 |
98 | #ifdef HAVE_PSI_TABLE_INTERFACE
99 | #define MYSQL_UNLOCK_TABLE(T) \
100 | inline_mysql_unlock_table(T)
101 | #else
102 | #define MYSQL_UNLOCK_TABLE(T) \
103 | do {} while (0)
104 | #endif
105 |
106 | #ifdef HAVE_PSI_TABLE_INTERFACE
107 | /**
108 | Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT.
109 | @sa MYSQL_END_TABLE_LOCK_WAIT.
110 | */
111 | static inline struct PSI_table_locker *
112 | inline_mysql_start_table_lock_wait(PSI_table_locker_state *state,
113 | struct PSI_table *psi,
114 | enum PSI_table_lock_operation op,
115 | ulong flags, const char *src_file, int src_line)
116 | {
117 | if (psi != NULL)
118 | {
119 | struct PSI_table_locker *locker;
120 | locker= PSI_TABLE_CALL(start_table_lock_wait)
121 | (state, psi, op, flags, src_file, src_line);
122 | return locker;
123 | }
124 | return NULL;
125 | }
126 |
127 | /**
128 | Instrumentation calls for MYSQL_END_TABLE_LOCK_WAIT.
129 | @sa MYSQL_START_TABLE_LOCK_WAIT.
130 | */
131 | static inline void
132 | inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker)
133 | {
134 | if (locker != NULL)
135 | PSI_TABLE_CALL(end_table_lock_wait)(locker);
136 | }
137 |
138 | static inline void
139 | inline_mysql_unlock_table(struct PSI_table *table)
140 | {
141 | if (table != NULL)
142 | PSI_TABLE_CALL(unlock_table)(table);
143 | }
144 | #endif
145 |
146 | /** @} (end of group Table_instrumentation) */
147 |
148 | #endif
149 |
150 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/psi/psi_base.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | Without limiting anything contained in the foregoing, this file,
15 | which is part of C Driver for MySQL (Connector/C), is also subject to the
16 | Universal FOSS Exception, version 1.0, a copy of which can be found at
17 | http://oss.oracle.com/licenses/universal-foss-exception.
18 |
19 | This program is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU General Public License, version 2.0, for more details.
23 |
24 | You should have received a copy of the GNU General Public License
25 | along with this program; if not, write to the Free Software Foundation,
26 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
27 |
28 | #ifndef MYSQL_PSI_BASE_H
29 | #define MYSQL_PSI_BASE_H
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | /**
36 | @file mysql/psi/psi_base.h
37 | Performance schema instrumentation interface.
38 |
39 | @defgroup Instrumentation_interface Instrumentation Interface
40 | @ingroup Performance_schema
41 | @{
42 | */
43 |
44 | #define PSI_INSTRUMENT_ME 0
45 |
46 | #define PSI_NOT_INSTRUMENTED 0
47 |
48 | /**
49 | Global flag.
50 | This flag indicate that an instrumentation point is a global variable,
51 | or a singleton.
52 | */
53 | #define PSI_FLAG_GLOBAL (1 << 0)
54 |
55 | /**
56 | Mutable flag.
57 | This flag indicate that an instrumentation point is a general placeholder,
58 | that can mutate into a more specific instrumentation point.
59 | */
60 | #define PSI_FLAG_MUTABLE (1 << 1)
61 |
62 | #define PSI_FLAG_THREAD (1 << 2)
63 |
64 | /**
65 | Stage progress flag.
66 | This flag apply to the stage instruments only.
67 | It indicates the instrumentation provides progress data.
68 | */
69 | #define PSI_FLAG_STAGE_PROGRESS (1 << 3)
70 |
71 | /**
72 | Shared Exclusive flag.
73 | Indicates that rwlock support the shared exclusive state.
74 | */
75 | #define PSI_RWLOCK_FLAG_SX (1 << 4)
76 |
77 | /**
78 | Transferable flag.
79 | This flag indicate that an instrumented object can
80 | be created by a thread and destroyed by another thread.
81 | */
82 | #define PSI_FLAG_TRANSFER (1 << 5)
83 |
84 | /**
85 | Volatility flag.
86 | This flag indicate that an instrumented object
87 | has a volatility (life cycle) comparable
88 | to the volatility of a session.
89 | */
90 | #define PSI_FLAG_VOLATILITY_SESSION (1 << 6)
91 |
92 | /**
93 | System thread flag.
94 | Indicates that the instrumented object exists on a system thread.
95 | */
96 | #define PSI_FLAG_THREAD_SYSTEM (1 << 9)
97 |
98 | #ifdef HAVE_PSI_INTERFACE
99 |
100 | /**
101 | @def PSI_VERSION_1
102 | Performance Schema Interface number for version 1.
103 | This version is supported.
104 | */
105 | #define PSI_VERSION_1 1
106 |
107 | /**
108 | @def PSI_VERSION_2
109 | Performance Schema Interface number for version 2.
110 | This version is not implemented, it's a placeholder.
111 | */
112 | #define PSI_VERSION_2 2
113 |
114 | /**
115 | @def PSI_CURRENT_VERSION
116 | Performance Schema Interface number for the most recent version.
117 | The most current version is @c PSI_VERSION_1
118 | */
119 | #define PSI_CURRENT_VERSION 1
120 |
121 | /**
122 | @def USE_PSI_1
123 | Define USE_PSI_1 to use the interface version 1.
124 | */
125 |
126 | /**
127 | @def USE_PSI_2
128 | Define USE_PSI_2 to use the interface version 2.
129 | */
130 |
131 | /**
132 | @def HAVE_PSI_1
133 | Define HAVE_PSI_1 if the interface version 1 needs to be compiled in.
134 | */
135 |
136 | /**
137 | @def HAVE_PSI_2
138 | Define HAVE_PSI_2 if the interface version 2 needs to be compiled in.
139 | */
140 |
141 | #ifndef USE_PSI_2
142 | #ifndef USE_PSI_1
143 | #define USE_PSI_1
144 | #endif
145 | #endif
146 |
147 | #ifdef USE_PSI_1
148 | #define HAVE_PSI_1
149 | #endif
150 |
151 | #ifdef USE_PSI_2
152 | #define HAVE_PSI_2
153 | #endif
154 |
155 | /*
156 | Allow to override PSI_XXX_CALL at compile time
157 | with more efficient implementations, if available.
158 | If nothing better is available,
159 | make a dynamic call using the PSI_server function pointer.
160 | */
161 |
162 | #define PSI_DYNAMIC_CALL(M) PSI_server->M
163 |
164 | #endif /* HAVE_PSI_INTERFACE */
165 |
166 | /** @} */
167 |
168 | #ifdef __cplusplus
169 | }
170 | #endif
171 |
172 | #endif /* MYSQL_PSI_BASE_H */
173 |
174 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_locking.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015, 2023, Oracle and/or its affiliates.
3 |
4 | This program is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License, version 2.0,
6 | as published by the Free Software Foundation.
7 |
8 | This program is also distributed with certain software (including
9 | but not limited to OpenSSL) that is licensed under separate terms,
10 | as designated in a particular file or component or in included license
11 | documentation. The authors of MySQL hereby grant you an additional
12 | permission to link the program and your derivative works with the
13 | separately licensed software that they have included with MySQL.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License, version 2.0, for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program; if not, write to the Free Software
22 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 | */
24 |
25 | #ifndef SERVICE_LOCKING_INCLUDED
26 | #define SERVICE_LOCKING_INCLUDED
27 |
28 | /*
29 | This service provides support for taking read/write locks.
30 | It is intended for use with fabric, but it is still a general
31 | service. The locks are in a separate namespace from other
32 | locks in the server, and there is also no interactions with
33 | transactions (i.e. locks are not released on commit/abort).
34 |
35 | These locks are implemented using the metadata lock (MDL) subsystem
36 | and thus deadlocks involving locking service locks and other types
37 | of metadata will be detected using the MDL deadlock detector.
38 | */
39 |
40 | #ifdef __cplusplus
41 | class THD;
42 | #define MYSQL_THD THD*
43 | #else
44 | #define MYSQL_THD void*
45 | #endif
46 |
47 | #ifdef __cplusplus
48 | extern "C" {
49 | #endif
50 |
51 | /**
52 | Types of locking service locks.
53 | LOCKING_SERVICE_READ is compatible with LOCKING_SERVICE_READ.
54 | All other combinations are incompatible.
55 | */
56 | enum enum_locking_service_lock_type
57 | { LOCKING_SERVICE_READ, LOCKING_SERVICE_WRITE };
58 |
59 | extern struct mysql_locking_service_st {
60 | /**
61 | Acquire locking service locks.
62 |
63 | @param opaque_thd Thread handle. If NULL, current_thd will be used.
64 | @param lock_namespace Namespace of the locks to acquire.
65 | @param lock_names Array of names of the locks to acquire.
66 | @param lock_num Number of elements in 'lock_names'.
67 | @param lock_type Lock type to acquire. LOCKING_SERVICE_READ or _WRITE.
68 | @param lock_timeout Number of seconds to wait before giving up.
69 |
70 | @retval 1 Acquisition failed, error has been reported.
71 | @retval 0 Acquisition successful, all locks acquired.
72 |
73 | @note both lock_namespace and lock_names are limited to 64 characters max.
74 | Names are compared using binary comparison.
75 | */
76 | int (*mysql_acquire_locks)(MYSQL_THD opaque_thd, const char* lock_namespace,
77 | const char**lock_names, size_t lock_num,
78 | enum enum_locking_service_lock_type lock_type,
79 | unsigned long lock_timeout);
80 |
81 | /**
82 | Release all lock service locks taken by the given connection
83 | in the given namespace.
84 |
85 | @param opaque_thd Thread handle. If NULL, current_thd will be used.
86 | @param lock_namespace Namespace of the locks to release.
87 |
88 | @retval 1 Release failed, error has been reported.
89 | @retval 0 Release successful, all locks acquired.
90 | */
91 | int (*mysql_release_locks)(MYSQL_THD opaque_thd, const char* lock_namespace);
92 | } *mysql_locking_service;
93 |
94 | #ifdef MYSQL_DYNAMIC_PLUGIN
95 |
96 | #define mysql_acquire_locking_service_locks(_THD, _NAMESPACE, _NAMES, _NUM, \
97 | _TYPE, _TIMEOUT) \
98 | mysql_locking_service->mysql_acquire_locks(_THD, _NAMESPACE, _NAMES, _NUM, \
99 | _TYPE, _TIMEOUT)
100 | #define mysql_release_locking_service_locks(_THD, _NAMESPACE) \
101 | mysql_locking_service->mysql_release_locks(_THD, _NAMESPACE)
102 |
103 | #else
104 |
105 | int mysql_acquire_locking_service_locks(MYSQL_THD opaque_thd,
106 | const char* lock_namespace,
107 | const char**lock_names,
108 | size_t lock_num,
109 | enum enum_locking_service_lock_type lock_type,
110 | unsigned long lock_timeout);
111 |
112 | int mysql_release_locking_service_locks(MYSQL_THD opaque_thd,
113 | const char* lock_namespace);
114 |
115 | #endif /* MYSQL_DYNAMIC_PLUGIN */
116 |
117 | #ifdef __cplusplus
118 | }
119 | #endif
120 |
121 | #endif /* SERVICE_LOCKING_INCLUDED */
122 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_my_plugin_log.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2011, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | /**
24 | @file
25 | This service provides functions to report error conditions and log to
26 | mysql error log.
27 | */
28 |
29 | #ifndef MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
30 | #define MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
31 |
32 | #ifndef MYSQL_ABI_CHECK
33 | #include
34 | #endif
35 |
36 | /* keep in sync with the loglevel enum in my_sys.h */
37 | enum plugin_log_level
38 | {
39 | MY_ERROR_LEVEL,
40 | MY_WARNING_LEVEL,
41 | MY_INFORMATION_LEVEL
42 | };
43 |
44 |
45 | #ifdef __cplusplus
46 | extern "C" {
47 | #endif
48 |
49 | extern struct my_plugin_log_service
50 | {
51 | /** write a message to the log */
52 | int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...);
53 | } *my_plugin_log_service;
54 |
55 | #ifdef MYSQL_DYNAMIC_PLUGIN
56 |
57 | #define my_plugin_log_message my_plugin_log_service->my_plugin_log_message
58 |
59 | #else
60 |
61 | int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
62 | const char *format, ...);
63 |
64 | #endif
65 |
66 | #ifdef __cplusplus
67 | }
68 | #endif
69 |
70 | #endif
71 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_my_snprintf.h:
--------------------------------------------------------------------------------
1 | #ifndef MYSQL_SERVICE_MY_SNPRINTF_INCLUDED
2 | #define MYSQL_SERVICE_MY_SNPRINTF_INCLUDED
3 | /* Copyright (c) 2009, 2023, Oracle and/or its affiliates.
4 |
5 | This program is free software; you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License, version 2.0,
7 | as published by the Free Software Foundation.
8 |
9 | This program is also distributed with certain software (including
10 | but not limited to OpenSSL) that is licensed under separate terms,
11 | as designated in a particular file or component or in included license
12 | documentation. The authors of MySQL hereby grant you an additional
13 | permission to link the program and your derivative works with the
14 | separately licensed software that they have included with MySQL.
15 |
16 | This program is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License, version 2.0, for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with this program; if not, write to the Free Software
23 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
24 |
25 | /**
26 | @file
27 | my_snprintf service
28 |
29 | Portable and limited vsnprintf() implementation.
30 |
31 | This is a portable, limited vsnprintf() implementation, with some
32 | extra features. "Portable" means that it'll produce identical result
33 | on all platforms (for example, on Windows and Linux system printf %e
34 | formats the exponent differently, on different systems %p either
35 | prints leading 0x or not, %s may accept null pointer or crash on
36 | it). "Limited" means that it does not support all the C89 features.
37 | But it supports few extensions, not in any standard.
38 |
39 | my_vsnprintf(to, n, fmt, ap)
40 |
41 | @param[out] to A buffer to store the result in
42 | @param[in] n Store up to n-1 characters, followed by an end 0
43 | @param[in] fmt printf-like format string
44 | @param[in] ap Arguments
45 |
46 | @return a number of bytes written to a buffer *excluding* terminating '\0'
47 |
48 | @post
49 | The syntax of a format string is generally the same:
50 | %
51 | where everithing but the format is optional.
52 |
53 | Three one-character flags are recognized:
54 | '0' has the standard zero-padding semantics;
55 | '-' is parsed, but silently ignored;
56 | '`' (backtick) is only supported for strings (%s) and means that the
57 | string will be quoted according to MySQL identifier quoting rules.
58 |
59 | Both and can be specified as numbers or '*'.
60 | If an asterisk is used, an argument of type int is consumed.
61 |
62 | can be 'l', 'll', or 'z'.
63 |
64 | Supported formats are 's' (null pointer is accepted, printed as
65 | "(null)"), 'b' (extension, see below), 'c', 'd', 'i', 'u', 'x', 'o',
66 | 'X', 'p' (works as 0x%x).
67 |
68 | Standard syntax for positional arguments $n is supported.
69 |
70 | Extensions:
71 |
72 | Flag '`' (backtick): see above.
73 |
74 | Format 'b': binary buffer, prints exactly bytes from the
75 | argument, without stopping at '\0'.
76 | */
77 |
78 | #ifdef __cplusplus
79 | extern "C" {
80 | #endif
81 |
82 | #ifndef MYSQL_ABI_CHECK
83 | #include
84 | #include
85 | #endif
86 |
87 | extern struct my_snprintf_service_st {
88 | size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
89 | size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
90 | } *my_snprintf_service;
91 |
92 | #ifdef MYSQL_DYNAMIC_PLUGIN
93 |
94 | #define my_vsnprintf my_snprintf_service->my_vsnprintf_type
95 | #define my_snprintf my_snprintf_service->my_snprintf_type
96 |
97 | #else
98 |
99 | size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
100 | size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
101 |
102 | #endif
103 |
104 | #ifdef __cplusplus
105 | }
106 | #endif
107 |
108 | #endif /* #define MYSQL_SERVICE_MY_SNPRINTF_INCLUDED */
109 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_mysql_alloc.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED
24 | #define MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED
25 |
26 | #ifndef MYSQL_ABI_CHECK
27 | #include
28 | #endif
29 |
30 | /* PSI_memory_key */
31 | #include "mysql/psi/psi_memory.h"
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | /* myf */
38 | typedef int myf_t;
39 |
40 | typedef void * (*mysql_malloc_t)(PSI_memory_key key, size_t size, myf_t flags);
41 | typedef void * (*mysql_realloc_t)(PSI_memory_key key, void *ptr, size_t size, myf_t flags);
42 | typedef void (*mysql_claim_t)(void *ptr);
43 | typedef void (*mysql_free_t)(void *ptr);
44 | typedef void * (*my_memdup_t)(PSI_memory_key key, const void *from, size_t length, myf_t flags);
45 | typedef char * (*my_strdup_t)(PSI_memory_key key, const char *from, myf_t flags);
46 | typedef char * (*my_strndup_t)(PSI_memory_key key, const char *from, size_t length, myf_t flags);
47 |
48 | struct mysql_malloc_service_st
49 | {
50 | mysql_malloc_t mysql_malloc;
51 | mysql_realloc_t mysql_realloc;
52 | mysql_claim_t mysql_claim;
53 | mysql_free_t mysql_free;
54 | my_memdup_t my_memdup;
55 | my_strdup_t my_strdup;
56 | my_strndup_t my_strndup;
57 | };
58 |
59 | extern struct mysql_malloc_service_st *mysql_malloc_service;
60 |
61 | #ifdef MYSQL_DYNAMIC_PLUGIN
62 |
63 | #define my_malloc mysql_malloc_service->mysql_malloc
64 | #define my_realloc mysql_malloc_service->mysql_realloc
65 | #define my_claim mysql_malloc_service->mysql_claim
66 | #define my_free mysql_malloc_service->mysql_free
67 | #define my_memdup mysql_malloc_service->my_memdup
68 | #define my_strdup mysql_malloc_service->my_strdup
69 | #define my_strndup mysql_malloc_service->my_strndup
70 |
71 | #else
72 |
73 | extern void * my_malloc(PSI_memory_key key, size_t size, myf_t flags);
74 | extern void * my_realloc(PSI_memory_key key, void *ptr, size_t size, myf_t flags);
75 | extern void my_claim(void *ptr);
76 | extern void my_free(void *ptr);
77 | extern void * my_memdup(PSI_memory_key key, const void *from, size_t length, myf_t flags);
78 | extern char * my_strdup(PSI_memory_key key, const char *from, myf_t flags);
79 | extern char * my_strndup(PSI_memory_key key, const char *from, size_t length, myf_t flags);
80 |
81 | #endif
82 |
83 | #ifdef __cplusplus
84 | }
85 | #endif
86 |
87 | #endif
88 |
89 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_mysql_keyring.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2014, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_SERVICE_MYSQL_PLUGIN_KEYRING_INCLUDED
24 | #define MYSQL_SERVICE_MYSQL_PLUGIN_KEYRING_INCLUDED
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | extern struct mysql_keyring_service_st
31 | {
32 | int (*my_key_store_func)(const char *, const char *, const char *,
33 | const void *, size_t);
34 | int (*my_key_fetch_func)(const char *, char **, const char *, void **,
35 | size_t *);
36 | int (*my_key_remove_func)(const char *, const char *);
37 | int (*my_key_generate_func)(const char *, const char *, const char *,
38 | size_t);
39 | } *mysql_keyring_service;
40 |
41 | #ifdef MYSQL_DYNAMIC_PLUGIN
42 |
43 | #define my_key_store(key_id, key_type, user_id, key, key_len) \
44 | mysql_keyring_service->my_key_store_func(key_id, key_type, user_id, key, \
45 | key_len)
46 | #define my_key_fetch(key_id, key_type, user_id, key, key_len) \
47 | mysql_keyring_service->my_key_fetch_func(key_id, key_type, user_id, key, \
48 | key_len)
49 | #define my_key_remove(key_id, user_id) \
50 | mysql_keyring_service->my_key_remove_func(key_id, user_id)
51 | #define my_key_generate(key_id, key_type, user_id, key_len) \
52 | mysql_keyring_service->my_key_generate_func(key_id, key_type, user_id, \
53 | key_len)
54 | #else
55 |
56 | int my_key_store(const char *, const char *, const char *, const void *, size_t);
57 | int my_key_fetch(const char *, char **, const char *, void **,
58 | size_t *);
59 | int my_key_remove(const char *, const char *);
60 | int my_key_generate(const char *, const char *, const char *, size_t);
61 |
62 | #endif
63 |
64 | #ifdef __cplusplus
65 | }
66 | #endif
67 |
68 | #endif //MYSQL_SERVICE_MYSQL_PLUGIN_KEYRING_INCLUDED
69 |
70 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_mysql_password_policy.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2014, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_SERVICE_MYSQL_PLUGIN_AUTH_INCLUDED
24 | #define MYSQL_SERVICE_MYSQL_PLUGIN_AUTH_INCLUDED
25 |
26 | /**
27 | @file include/mysql/service_mysql_plugin_auth.h
28 | This service provides functions to validatete password, check for strength
29 | of password based on common policy.
30 |
31 | SYNOPSIS
32 | my_validate_password_policy() - function to validate password
33 | based on defined policy
34 | const char* buffer holding the password value
35 | unsigned int buffer length
36 |
37 | my_calculate_password_strength() - function to calculate strength
38 | of the password based on the policies defined.
39 | const char* buffer holding the password value
40 | unsigned int buffer length
41 |
42 | Both the service function returns 0 on SUCCESS and 1 incase input password does not
43 | match against the policy rules defined.
44 | */
45 |
46 | #ifdef __cplusplus
47 | extern "C" {
48 | #endif
49 |
50 | extern struct mysql_password_policy_service_st {
51 | int (*my_validate_password_policy_func)(const char *, unsigned int);
52 | int (*my_calculate_password_strength_func)(const char *, unsigned int);
53 | } *mysql_password_policy_service;
54 |
55 | #ifdef MYSQL_DYNAMIC_PLUGIN
56 |
57 | #define my_validate_password_policy(buffer, length) \
58 | mysql_password_policy_service->my_validate_password_policy_func(buffer, length)
59 | #define my_calculate_password_strength(buffer, length) \
60 | mysql_password_policy_service->my_calculate_password_strength_func(buffer, length)
61 |
62 | #else
63 |
64 | int my_validate_password_policy(const char *, unsigned int);
65 | int my_calculate_password_strength(const char *, unsigned int);
66 |
67 | #endif
68 |
69 | #ifdef __cplusplus
70 | }
71 | #endif
72 |
73 | #endif
74 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_rpl_transaction_ctx.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2014, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_SERVICE_RPL_TRANSACTION_CTX_INCLUDED
24 |
25 | /**
26 | @file include/mysql/service_rpl_transaction_ctx.h
27 | This service provides a function for plugins to report if a transaction of a
28 | given THD should continue or be aborted.
29 |
30 | SYNOPSIS
31 | set_transaction_ctx()
32 | should be called during RUN_HOOK macro, on which we know that thread is
33 | on plugin context and it is before
34 | Rpl_transaction_ctx::is_transaction_rollback() check.
35 | */
36 |
37 | #ifndef MYSQL_ABI_CHECK
38 | #include
39 | #endif
40 |
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 | struct st_transaction_termination_ctx
46 | {
47 | unsigned long m_thread_id;
48 | unsigned int m_flags; // reserved
49 |
50 | /*
51 | If the instruction is to rollback the transaction,
52 | then this flag is set to false.
53 | Note: type is char like on my_bool.
54 | */
55 | char m_rollback_transaction;
56 |
57 | /*
58 | If the plugin has generated a GTID, then the follwoing
59 | fields MUST be set.
60 | Note: type is char like on my_bool.
61 | */
62 | char m_generated_gtid;
63 | int m_sidno;
64 | long long int m_gno;
65 | };
66 | typedef struct st_transaction_termination_ctx Transaction_termination_ctx;
67 |
68 | extern struct rpl_transaction_ctx_service_st {
69 | int (*set_transaction_ctx)(Transaction_termination_ctx transaction_termination_ctx);
70 | } *rpl_transaction_ctx_service;
71 |
72 | #ifdef MYSQL_DYNAMIC_PLUGIN
73 |
74 | #define set_transaction_ctx(transaction_termination_ctx) \
75 | (rpl_transaction_ctx_service->set_transaction_ctx((transaction_termination_ctx)))
76 |
77 | #else
78 |
79 | int set_transaction_ctx(Transaction_termination_ctx transaction_termination_ctx);
80 |
81 | #endif
82 |
83 | #ifdef __cplusplus
84 | }
85 | #endif
86 |
87 | #define MYSQL_SERVICE_RPL_TRANSACTION_CTX_INCLUDED
88 | #endif
89 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_rpl_transaction_write_set.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2014, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_SERVICE_TRANSACTION_WRITE_SET_INCLUDED
24 |
25 | /**
26 | @file include/mysql/service_rpl_transaction_write_set.h
27 | This service provides a function for plugins to get the write set of a given
28 | transaction.
29 |
30 | SYNOPSIS
31 | get_transaction_write_set()
32 | This service is used to fetch the write_set extracted for the currently
33 | executing transaction by passing the thread_id as an input parameter for
34 | the method.
35 |
36 | @param [in] - thread_id - It is the thread identifier of the currently
37 | executing thread.
38 |
39 | In the current implementation it is being called during RUN_HOOK macro,
40 | on which we know that thread is on plugin context.
41 |
42 | Cleanup :
43 | The service caller must take of the memory allocated during the service
44 | call to prevent memory leaks.
45 | */
46 |
47 | #ifndef MYSQL_ABI_CHECK
48 | #include
49 | #endif
50 |
51 | #ifdef __cplusplus
52 | extern "C" {
53 | #endif
54 |
55 | /**
56 | This structure is used to keep the list of the hash values of the records
57 | changed in the transaction.
58 | */
59 | struct st_trans_write_set
60 | {
61 | unsigned int m_flags; // reserved
62 | unsigned long write_set_size; // Size of the PKE set of the transaction.
63 | unsigned long long* write_set; // A pointer to the PKE set.
64 | };
65 | typedef struct st_trans_write_set Transaction_write_set;
66 |
67 | extern struct transaction_write_set_service_st {
68 | Transaction_write_set* (*get_transaction_write_set)(unsigned long m_thread_id);
69 | void (*require_full_write_set)(int requires_ws);
70 | void (*set_write_set_memory_size_limit)(long long size_limit);
71 | void (*update_write_set_memory_size_limit)(long long size_limit);
72 | } *transaction_write_set_service;
73 |
74 | #ifdef MYSQL_DYNAMIC_PLUGIN
75 |
76 | #define get_transaction_write_set(m_thread_id) \
77 | (transaction_write_set_service->get_transaction_write_set((m_thread_id)))
78 | #define require_full_write_set(requires_ws) \
79 | transaction_write_set_service->require_full_write_set(requires_ws)
80 | #define set_write_set_memory_size_limit(size_limit) \
81 | transaction_write_set_service->set_write_set_memory_size_limit(size_limit)
82 | #define update_write_set_memory_size_limit(size_limit) \
83 | transaction_write_set_service->update_write_set_memory_size_limit(size_limit)
84 |
85 | #else
86 |
87 | Transaction_write_set* get_transaction_write_set(unsigned long m_thread_id);
88 |
89 | void require_full_write_set(int requires_ws);
90 |
91 | void set_write_set_memory_size_limit(long long size_limit);
92 |
93 | void update_write_set_memory_size_limit(long long size_limit);
94 |
95 | #endif
96 |
97 | #ifdef __cplusplus
98 | }
99 | #endif
100 |
101 | #define MYSQL_SERVICE_TRANSACTION_WRITE_SET_INCLUDED
102 | #endif
103 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_security_context.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2015, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_SERVICE_SECURITY_CONTEXT
24 | #define MYSQL_SERVICE_SECURITY_CONTEXT
25 |
26 | /**
27 | @file include/mysql/service_security_context.h
28 |
29 | This service provides functions for plugins and storage engines to
30 | manipulate the thread's security context.
31 | */
32 |
33 | #ifdef __cplusplus
34 | class Security_context;
35 | #define MYSQL_SECURITY_CONTEXT Security_context*
36 | #else
37 | #define MYSQL_SECURITY_CONTEXT void*
38 | #endif
39 | typedef char my_svc_bool;
40 |
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 | extern struct security_context_service_st {
46 | my_svc_bool (*thd_get_security_context)(MYSQL_THD, MYSQL_SECURITY_CONTEXT *out_ctx);
47 | my_svc_bool (*thd_set_security_context)(MYSQL_THD, MYSQL_SECURITY_CONTEXT in_ctx);
48 |
49 | my_svc_bool (*security_context_create)(MYSQL_SECURITY_CONTEXT *out_ctx);
50 | my_svc_bool (*security_context_destroy)(MYSQL_SECURITY_CONTEXT);
51 | my_svc_bool (*security_context_copy)(MYSQL_SECURITY_CONTEXT in_ctx, MYSQL_SECURITY_CONTEXT *out_ctx);
52 |
53 | my_svc_bool (*security_context_lookup)(MYSQL_SECURITY_CONTEXT ctx,
54 | const char *user, const char *host,
55 | const char *ip, const char *db);
56 |
57 | my_svc_bool (*security_context_get_option)(MYSQL_SECURITY_CONTEXT, const char *name, void *inout_pvalue);
58 | my_svc_bool (*security_context_set_option)(MYSQL_SECURITY_CONTEXT, const char *name, void *pvalue);
59 | } *security_context_service;
60 |
61 | #ifdef MYSQL_DYNAMIC_PLUGIN
62 |
63 | #define thd_get_security_context(_THD, _CTX) \
64 | security_context_service->thd_get_security_context(_THD, _CTX)
65 | #define thd_set_security_context(_THD, _CTX) \
66 | security_context_service->thd_set_security_context(_THD, _CTX)
67 |
68 | #define security_context_create(_CTX) \
69 | security_context_service->security_context_create(_CTX)
70 | #define security_context_destroy(_CTX) \
71 | security_context_service->security_context_destroy(_CTX)
72 | #define security_context_copy(_CTX1, _CTX2) \
73 | security_context_service->security_context_copy(_CTX1,_CTX2)
74 |
75 | #define security_context_lookup(_CTX, _U, _H, _IP, _DB) \
76 | security_context_service->security_context_lookup(_CTX, _U, _H, _IP, _DB)
77 |
78 | #define security_context_get_option(_SEC_CTX, _NAME, _VALUE) \
79 | security_context_service->security_context_get_option(_SEC_CTX, _NAME, _VALUE)
80 | #define security_context_set_option(_SEC_CTX, _NAME, _VALUE) \
81 | security_context_service->security_context_set_option(_SEC_CTX, _NAME, _VALUE)
82 | #else
83 | my_svc_bool thd_get_security_context(MYSQL_THD, MYSQL_SECURITY_CONTEXT *out_ctx);
84 | my_svc_bool thd_set_security_context(MYSQL_THD, MYSQL_SECURITY_CONTEXT in_ctx);
85 |
86 | my_svc_bool security_context_create(MYSQL_SECURITY_CONTEXT *out_ctx);
87 | my_svc_bool security_context_destroy(MYSQL_SECURITY_CONTEXT ctx);
88 | my_svc_bool security_context_copy(MYSQL_SECURITY_CONTEXT in_ctx, MYSQL_SECURITY_CONTEXT *out_ctx);
89 |
90 | my_svc_bool security_context_lookup(MYSQL_SECURITY_CONTEXT ctx,
91 | const char *user, const char *host,
92 | const char *ip, const char *db);
93 |
94 | my_svc_bool security_context_get_option(MYSQL_SECURITY_CONTEXT, const char *name, void *inout_pvalue);
95 | my_svc_bool security_context_set_option(MYSQL_SECURITY_CONTEXT, const char *name, void *pvalue);
96 | #endif /* !MYSQL_DYNAMIC_PLUGIN */
97 |
98 | #ifdef __cplusplus
99 | }
100 | #endif /* _cplusplus */
101 |
102 | #endif /* !MYSQL_SERVICE_SECURITY_CONTEXT */
103 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_thd_engine_lock.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2015, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_SERVICE_THD_EGINE_LOCK_INCLUDED
24 | #define MYSQL_SERVICE_THD_EGINE_LOCK_INCLUDED
25 |
26 | /**
27 | @file include/mysql/service_thd_engine_lock.h
28 | This service provides functions for storage engines to report
29 | lock related activities.
30 |
31 | SYNOPSIS
32 | thd_row_lock_wait() - call it just when the engine find a transaction should wait
33 | another transaction to realease a row lock
34 | thd The session which is waiting for the row lock to release.
35 | thd_wait_for The session which is holding the row lock.
36 | */
37 |
38 | #ifdef __cplusplus
39 | class THD;
40 | #else
41 | #define THD void
42 | #endif
43 |
44 | #ifdef __cplusplus
45 | extern "C" {
46 | #endif
47 |
48 | void thd_report_row_lock_wait(THD* self, THD *wait_for);
49 |
50 | #ifdef __cplusplus
51 | }
52 | #endif
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_thd_wait.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_SERVICE_THD_WAIT_INCLUDED
24 | #define MYSQL_SERVICE_THD_WAIT_INCLUDED
25 |
26 | /**
27 | @file include/mysql/service_thd_wait.h
28 | This service provides functions for plugins and storage engines to report
29 | when they are going to sleep/stall.
30 |
31 | SYNOPSIS
32 | thd_wait_begin() - call just before a wait begins
33 | thd Thread object
34 | Use NULL if the thd is NOT known.
35 | wait_type Type of wait
36 | 1 -- short wait (e.g. for mutex)
37 | 2 -- medium wait (e.g. for disk io)
38 | 3 -- large wait (e.g. for locked row/table)
39 | NOTES
40 | This is used by the threadpool to have better knowledge of which
41 | threads that currently are actively running on CPUs. When a thread
42 | reports that it's going to sleep/stall, the threadpool scheduler is
43 | free to start another thread in the pool most likely. The expected wait
44 | time is simply an indication of how long the wait is expected to
45 | become, the real wait time could be very different.
46 |
47 | thd_wait_end() called immediately after the wait is complete
48 |
49 | thd_wait_end() MUST be called if thd_wait_begin() was called.
50 |
51 | Using thd_wait_...() service is optional but recommended. Using it will
52 | improve performance as the thread pool will be more active at managing the
53 | thread workload.
54 | */
55 |
56 | #ifdef __cplusplus
57 | class THD;
58 | #define MYSQL_THD THD*
59 | #else
60 | #define MYSQL_THD void*
61 | #endif
62 |
63 | #ifdef __cplusplus
64 | extern "C" {
65 | #endif
66 |
67 | /*
68 | One should only report wait events that could potentially block for a
69 | long time. A mutex wait is too short of an event to report. The reason
70 | is that an event which is reported leads to a new thread starts
71 | executing a query and this has a negative impact of usage of CPU caches
72 | and thus the expected gain of starting a new thread must be higher than
73 | the expected cost of lost performance due to starting a new thread.
74 |
75 | Good examples of events that should be reported are waiting for row locks
76 | that could easily be for many milliseconds or even seconds and the same
77 | holds true for global read locks, table locks and other meta data locks.
78 | Another event of interest is going to sleep for an extended time.
79 |
80 | Note that user-level locks no longer use THD_WAIT_USER_LOCK wait type.
81 | Since their implementation relies on metadata locks manager it uses
82 | THD_WAIT_META_DATA_LOCK instead.
83 | */
84 | typedef enum _thd_wait_type_e {
85 | THD_WAIT_SLEEP= 1,
86 | THD_WAIT_DISKIO= 2,
87 | THD_WAIT_ROW_LOCK= 3,
88 | THD_WAIT_GLOBAL_LOCK= 4,
89 | THD_WAIT_META_DATA_LOCK= 5,
90 | THD_WAIT_TABLE_LOCK= 6,
91 | THD_WAIT_USER_LOCK= 7,
92 | THD_WAIT_BINLOG= 8,
93 | THD_WAIT_GROUP_COMMIT= 9,
94 | THD_WAIT_SYNC= 10,
95 | THD_WAIT_LAST= 11
96 | } thd_wait_type;
97 |
98 | extern struct thd_wait_service_st {
99 | void (*thd_wait_begin_func)(MYSQL_THD, int);
100 | void (*thd_wait_end_func)(MYSQL_THD);
101 | } *thd_wait_service;
102 |
103 | #ifdef MYSQL_DYNAMIC_PLUGIN
104 |
105 | #define thd_wait_begin(_THD, _WAIT_TYPE) \
106 | thd_wait_service->thd_wait_begin_func(_THD, _WAIT_TYPE)
107 | #define thd_wait_end(_THD) thd_wait_service->thd_wait_end_func(_THD)
108 |
109 | #else
110 |
111 | void thd_wait_begin(MYSQL_THD thd, int wait_type);
112 | void thd_wait_end(MYSQL_THD thd);
113 |
114 | #endif
115 |
116 | #ifdef __cplusplus
117 | }
118 | #endif
119 |
120 | #endif
121 |
122 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/service_thread_scheduler.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, 2023, Oracle and/or its affiliates.
3 |
4 | This program is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License, version 2.0,
6 | as published by the Free Software Foundation.
7 |
8 | This program is also distributed with certain software (including
9 | but not limited to OpenSSL) that is licensed under separate terms,
10 | as designated in a particular file or component or in included license
11 | documentation. The authors of MySQL hereby grant you an additional
12 | permission to link the program and your derivative works with the
13 | separately licensed software that they have included with MySQL.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License, version 2.0, for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program; if not, write to the Free Software
22 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 | */
24 |
25 | #ifndef SERVICE_THREAD_SCHEDULER_INCLUDED
26 | #define SERVICE_THREAD_SCHEDULER_INCLUDED
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | struct Connection_handler_functions;
33 | struct THD_event_functions;
34 |
35 | extern struct my_thread_scheduler_service {
36 | int (*connection_handler_set)(struct Connection_handler_functions *,
37 | struct THD_event_functions *);
38 | int (*connection_handler_reset)();
39 | } *my_thread_scheduler_service;
40 |
41 |
42 | #ifdef MYSQL_DYNAMIC_PLUGIN
43 |
44 | #define my_connection_handler_set(F, M) \
45 | my_thread_scheduler_service->connection_handler_set((F), (M))
46 | #define my_connection_handler_reset() \
47 | my_thread_scheduler_service->connection_handler_reset()
48 |
49 | #else
50 |
51 | /**
52 | Instantiates Plugin_connection_handler based on the supplied
53 | Conection_handler_functions and sets it as the current
54 | connection handler.
55 |
56 | Also sets the THD_event_functions functions which will
57 | be called by the server when e.g. begining a wait.
58 |
59 | Remembers the existing connection handler so that it can be restored later.
60 |
61 | @param chf struct with functions to be called when e.g. handling
62 | new clients.
63 | @param tef struct with functions to be called when events
64 | (e.g. lock wait) happens.
65 |
66 | @note Both pointers (i.e. not the structs themselves) will be copied,
67 | so the structs must not disappear.
68 |
69 | @note We don't support dynamically loading more than one connection handler.
70 |
71 | @retval 1 failure
72 | @retval 0 success
73 | */
74 | int my_connection_handler_set(struct Connection_handler_functions *chf,
75 | struct THD_event_functions *tef);
76 |
77 | /**
78 | Destroys the current connection handler and restores the previous.
79 | Should only be called after calling my_connection_handler_set().
80 |
81 | @retval 1 failure
82 | @retval 0 success
83 | */
84 | int my_connection_handler_reset();
85 |
86 | #endif /* MYSQL_DYNAMIC_PLUGIN */
87 |
88 | #ifdef __cplusplus
89 | }
90 | #endif
91 |
92 | #endif /* SERVICE_THREAD_SCHEDULER_INCLUDED */
93 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/services.h:
--------------------------------------------------------------------------------
1 | #ifndef MYSQL_SERVICES_INCLUDED
2 | /* Copyright (c) 2009, 2023, Oracle and/or its affiliates.
3 |
4 | This program is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License, version 2.0,
6 | as published by the Free Software Foundation.
7 |
8 | This program is also distributed with certain software (including
9 | but not limited to OpenSSL) that is licensed under separate terms,
10 | as designated in a particular file or component or in included license
11 | documentation. The authors of MySQL hereby grant you an additional
12 | permission to link the program and your derivative works with the
13 | separately licensed software that they have included with MySQL.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License, version 2.0, for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program; if not, write to the Free Software
22 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23 |
24 |
25 | /*
26 | Out of extern because of inclusion of files which include my_compiler.h
27 | which in turn complains about C-linkage of templates.
28 | service_srv_session.h and service_command.h use proper extern "C" for
29 | their exported symbols.
30 | */
31 | #ifndef EMBEDDED_LIBRARY
32 | #include
33 | #include
34 | #include
35 | #endif
36 |
37 |
38 | #ifdef __cplusplus
39 | extern "C" {
40 | #endif
41 |
42 | #include
43 | #include
44 | #include
45 | #include
46 | #include
47 | #include
48 | #include
49 | #include
50 | #include
51 | #include
52 | #include
53 | #include
54 | #include
55 | #include
56 |
57 | #ifdef __cplusplus
58 | }
59 | #endif
60 |
61 | #ifdef __cplusplus
62 | #include
63 | #endif
64 |
65 | #define MYSQL_SERVICES_INCLUDED
66 | #endif /* MYSQL_SERVICES_INCLUDED */
67 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql/thread_type.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
22 |
23 | /* Defines to make different thread packages compatible */
24 |
25 | #ifndef THREAD_TYPE_INCLUDED
26 | #define THREAD_TYPE_INCLUDED
27 |
28 | #ifdef __cplusplus
29 | extern "C"{
30 | #endif
31 |
32 | /* Flags for the THD::system_thread variable */
33 | enum enum_thread_type
34 | {
35 | NON_SYSTEM_THREAD= 0,
36 | SYSTEM_THREAD_SLAVE_IO= 1,
37 | SYSTEM_THREAD_SLAVE_SQL= 2,
38 | SYSTEM_THREAD_NDBCLUSTER_BINLOG= 4,
39 | SYSTEM_THREAD_EVENT_SCHEDULER= 8,
40 | SYSTEM_THREAD_EVENT_WORKER= 16,
41 | SYSTEM_THREAD_INFO_REPOSITORY= 32,
42 | SYSTEM_THREAD_SLAVE_WORKER= 64,
43 | SYSTEM_THREAD_COMPRESS_GTID_TABLE= 128,
44 | SYSTEM_THREAD_BACKGROUND= 256
45 | };
46 |
47 | #ifdef __cplusplus
48 | }
49 | #endif
50 |
51 | #endif /* THREAD_TYPE_INCLUDED */
52 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql_com_server.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2011, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | /*
24 | Definitions private to the server,
25 | used in the networking layer to notify specific events.
26 | */
27 |
28 | #ifndef _mysql_com_server_h
29 | #define _mysql_com_server_h
30 |
31 | struct st_net_server;
32 |
33 | typedef void (*before_header_callback_fn)
34 | (struct st_net *net, void *user_data, size_t count);
35 |
36 | typedef void (*after_header_callback_fn)
37 | (struct st_net *net, void *user_data, size_t count, my_bool rc);
38 |
39 | struct st_net_server
40 | {
41 | before_header_callback_fn m_before_header;
42 | after_header_callback_fn m_after_header;
43 | void *m_user_data;
44 | my_bool timeout_on_full_packet;
45 |
46 | st_net_server() {
47 | m_before_header = NULL;
48 | m_after_header = NULL;
49 | m_user_data = NULL;
50 | timeout_on_full_packet = FALSE;
51 | }
52 | };
53 |
54 | typedef struct st_net_server NET_SERVER;
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql_embed.h:
--------------------------------------------------------------------------------
1 | #ifndef MYSQL_EMBED_INCLUDED
2 | #define MYSQL_EMBED_INCLUDED
3 |
4 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
5 |
6 | This program is free software; you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License, version 2.0,
8 | as published by the Free Software Foundation.
9 |
10 | This program is also distributed with certain software (including
11 | but not limited to OpenSSL) that is licensed under separate terms,
12 | as designated in a particular file or component or in included license
13 | documentation. The authors of MySQL hereby grant you an additional
14 | permission to link the program and your derivative works with the
15 | separately licensed software that they have included with MySQL.
16 |
17 | This program is distributed in the hope that it will be useful,
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | GNU General Public License, version 2.0, for more details.
21 |
22 | You should have received a copy of the GNU General Public License
23 | along with this program; if not, write to the Free Software
24 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25 |
26 | /* Defines that are unique to the embedded version of MySQL */
27 |
28 | #ifdef EMBEDDED_LIBRARY
29 |
30 | /* Things we don't need in the embedded version of MySQL */
31 | /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
32 |
33 | #undef HAVE_DLOPEN /* No udf functions */
34 |
35 | #endif /* EMBEDDED_LIBRARY */
36 | #endif /* MYSQL_EMBED_INCLUDED */
37 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql_time.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2004, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | Without limiting anything contained in the foregoing, this file,
15 | which is part of C Driver for MySQL (Connector/C), is also subject to the
16 | Universal FOSS Exception, version 1.0, a copy of which can be found at
17 | http://oss.oracle.com/licenses/universal-foss-exception.
18 |
19 | This program is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU General Public License, version 2.0, for more details.
23 |
24 | You should have received a copy of the GNU General Public License
25 | along with this program; if not, write to the Free Software
26 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
27 |
28 | #ifndef _mysql_time_h_
29 | #define _mysql_time_h_
30 |
31 | /*
32 | Time declarations shared between the server and client API:
33 | you should not add anything to this header unless it's used
34 | (and hence should be visible) in mysql.h.
35 | If you're looking for a place to add new time-related declaration,
36 | it's most likely my_time.h. See also "C API Handling of Date
37 | and Time Values" chapter in documentation.
38 | */
39 |
40 | enum enum_mysql_timestamp_type
41 | {
42 | MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
43 | MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
44 | };
45 |
46 |
47 | /*
48 | Structure which is used to represent datetime values inside MySQL.
49 |
50 | We assume that values in this structure are normalized, i.e. year <= 9999,
51 | month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions
52 | in server such as my_system_gmt_sec() or make_time() family of functions
53 | rely on this (actually now usage of make_*() family relies on a bit weaker
54 | restriction). Also functions that produce MYSQL_TIME as result ensure this.
55 | There is one exception to this rule though if this structure holds time
56 | value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold
57 | bigger values.
58 | */
59 | typedef struct st_mysql_time
60 | {
61 | unsigned int year, month, day, hour, minute, second;
62 | unsigned long second_part; /**< microseconds */
63 | my_bool neg;
64 | enum enum_mysql_timestamp_type time_type;
65 | } MYSQL_TIME;
66 |
67 | #endif /* _mysql_time_h_ */
68 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysql_version.h:
--------------------------------------------------------------------------------
1 | /* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB
2 | & Detron HB, 1996, 1999-2004, 2007 MySQL AB.
3 | This file is public domain and comes with NO WARRANTY of any kind
4 | */
5 |
6 | /* Version numbers for protocol & mysqld */
7 |
8 | #ifndef _mysql_version_h
9 | #define _mysql_version_h
10 |
11 | #define PROTOCOL_VERSION 10
12 | #define MYSQL_SERVER_VERSION "5.7.44"
13 | #define MYSQL_BASE_VERSION "mysqld-5.7"
14 | #define MYSQL_SERVER_SUFFIX_DEF ""
15 | #define FRM_VER 6
16 | #define MYSQL_VERSION_ID 50744
17 | #define MYSQL_PORT 3306
18 | #define MYSQL_PORT_DEFAULT 0
19 | #define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
20 | #define MYSQL_CONFIG_NAME "my"
21 | #define MYSQL_COMPILATION_COMMENT "MySQL Community Server (GPL)"
22 | #define LIBMYSQL_VERSION "5.7.44"
23 | #define LIBMYSQL_VERSION_ID 50744
24 | #define SYS_SCHEMA_VERSION "1.5.2"
25 |
26 | #ifndef LICENSE
27 | #define LICENSE GPL
28 | #endif /* LICENSE */
29 |
30 | #endif /* _mysql_version_h */
31 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysqlx_ername.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016, 2023, Oracle and/or its affiliates.
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License, version 2.0,
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is also distributed with certain software (including
9 | * but not limited to OpenSSL) that is licensed under separate terms,
10 | * as designated in a particular file or component or in included license
11 | * documentation. The authors of MySQL hereby grant you an additional
12 | * permission to link the program and your derivative works with the
13 | * separately licensed software that they have included with MySQL.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License, version 2.0, for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program; if not, write to the Free Software
22 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 | * 02110-1301 USA
24 | */
25 |
26 | /* Autogenerated file, please don't edit */
27 |
28 | #include "mysqlx_error.h"
29 |
30 | {"ER_X_BAD_MESSAGE", ER_X_BAD_MESSAGE, ""},
31 | {"ER_X_CAPABILITIES_PREPARE_FAILED", ER_X_CAPABILITIES_PREPARE_FAILED, ""},
32 | {"ER_X_CAPABILITY_NOT_FOUND", ER_X_CAPABILITY_NOT_FOUND, ""},
33 | {"ER_X_INVALID_PROTOCOL_DATA", ER_X_INVALID_PROTOCOL_DATA, ""},
34 | {"ER_X_SERVICE_ERROR", ER_X_SERVICE_ERROR, ""},
35 | {"ER_X_SESSION", ER_X_SESSION, ""},
36 | {"ER_X_INVALID_ARGUMENT", ER_X_INVALID_ARGUMENT, ""},
37 | {"ER_X_MISSING_ARGUMENT", ER_X_MISSING_ARGUMENT, ""},
38 | {"ER_X_BAD_INSERT_DATA", ER_X_BAD_INSERT_DATA, ""},
39 | {"ER_X_CMD_NUM_ARGUMENTS", ER_X_CMD_NUM_ARGUMENTS, ""},
40 | {"ER_X_CMD_ARGUMENT_TYPE", ER_X_CMD_ARGUMENT_TYPE, ""},
41 | {"ER_X_CMD_ARGUMENT_VALUE", ER_X_CMD_ARGUMENT_VALUE, ""},
42 | {"ER_X_BAD_UPDATE_DATA", ER_X_BAD_UPDATE_DATA, ""},
43 | {"ER_X_BAD_TYPE_OF_UPDATE", ER_X_BAD_TYPE_OF_UPDATE, ""},
44 | {"ER_X_BAD_COLUMN_TO_UPDATE", ER_X_BAD_COLUMN_TO_UPDATE, ""},
45 | {"ER_X_BAD_MEMBER_TO_UPDATE", ER_X_BAD_MEMBER_TO_UPDATE, ""},
46 | {"ER_X_BAD_STATEMENT_ID", ER_X_BAD_STATEMENT_ID, ""},
47 | {"ER_X_BAD_CURSOR_ID", ER_X_BAD_CURSOR_ID, ""},
48 | {"ER_X_BAD_SCHEMA", ER_X_BAD_SCHEMA, ""},
49 | {"ER_X_BAD_TABLE", ER_X_BAD_TABLE, ""},
50 | {"ER_X_BAD_PROJECTION", ER_X_BAD_PROJECTION, ""},
51 | {"ER_X_DOC_ID_MISSING", ER_X_DOC_ID_MISSING, ""},
52 | {"ER_X_DOC_ID_DUPLICATE", ER_X_DOC_ID_DUPLICATE, ""},
53 | {"ER_X_DOC_REQUIRED_FIELD_MISSING", ER_X_DOC_REQUIRED_FIELD_MISSING, ""},
54 | {"ER_X_PROJ_BAD_KEY_NAME", ER_X_PROJ_BAD_KEY_NAME, ""},
55 | {"ER_X_BAD_DOC_PATH", ER_X_BAD_DOC_PATH, ""},
56 | {"ER_X_CURSOR_EXISTS", ER_X_CURSOR_EXISTS, ""},
57 | {"ER_X_EXPR_BAD_OPERATOR", ER_X_EXPR_BAD_OPERATOR, ""},
58 | {"ER_X_EXPR_BAD_NUM_ARGS", ER_X_EXPR_BAD_NUM_ARGS, ""},
59 | {"ER_X_EXPR_MISSING_ARG", ER_X_EXPR_MISSING_ARG, ""},
60 | {"ER_X_EXPR_BAD_TYPE_VALUE", ER_X_EXPR_BAD_TYPE_VALUE, ""},
61 | {"ER_X_EXPR_BAD_VALUE", ER_X_EXPR_BAD_VALUE, ""},
62 | {"ER_X_INVALID_COLLECTION", ER_X_INVALID_COLLECTION, ""},
63 | {"ER_X_INVALID_ADMIN_COMMAND", ER_X_INVALID_ADMIN_COMMAND, ""},
64 | {"ER_X_EXPECT_NOT_OPEN", ER_X_EXPECT_NOT_OPEN, ""},
65 | {"ER_X_EXPECT_FAILED", ER_X_EXPECT_FAILED, ""},
66 | {"ER_X_EXPECT_BAD_CONDITION", ER_X_EXPECT_BAD_CONDITION, ""},
67 | {"ER_X_EXPECT_BAD_CONDITION_VALUE", ER_X_EXPECT_BAD_CONDITION_VALUE, ""},
68 | {"ER_X_INVALID_NAMESPACE", ER_X_INVALID_NAMESPACE, ""},
69 | {"ER_X_BAD_NOTICE", ER_X_BAD_NOTICE, ""},
70 | {"ER_X_CANNOT_DISABLE_NOTICE", ER_X_CANNOT_DISABLE_NOTICE, ""},
71 | {"ER_X_BAD_CONFIGURATION", ER_X_BAD_CONFIGURATION, ""},
72 | {"ER_X_MYSQLX_ACCOUNT_MISSING_PERMISSIONS", ER_X_MYSQLX_ACCOUNT_MISSING_PERMISSIONS, ""},
73 |
74 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysqlx_error.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2015, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 |
24 | #ifndef _MYSQLX_ERROR_H_
25 | #define _MYSQLX_ERROR_H_
26 |
27 | #define ER_X_BAD_MESSAGE 5000
28 | #define ER_X_CAPABILITIES_PREPARE_FAILED 5001
29 | #define ER_X_CAPABILITY_NOT_FOUND 5002
30 | #define ER_X_INVALID_PROTOCOL_DATA 5003
31 |
32 | #define ER_X_SERVICE_ERROR 5010
33 | #define ER_X_SESSION 5011
34 | #define ER_X_INVALID_ARGUMENT 5012
35 | #define ER_X_MISSING_ARGUMENT 5013
36 | #define ER_X_BAD_INSERT_DATA 5014
37 | #define ER_X_CMD_NUM_ARGUMENTS 5015
38 | #define ER_X_CMD_ARGUMENT_TYPE 5016
39 | #define ER_X_CMD_ARGUMENT_VALUE 5017
40 | #define ER_X_BAD_UPDATE_DATA 5050
41 | #define ER_X_BAD_TYPE_OF_UPDATE 5051
42 | #define ER_X_BAD_COLUMN_TO_UPDATE 5052
43 | #define ER_X_BAD_MEMBER_TO_UPDATE 5053
44 | #define ER_X_BAD_STATEMENT_ID 5110
45 | #define ER_X_BAD_CURSOR_ID 5111
46 | #define ER_X_BAD_SCHEMA 5112
47 | #define ER_X_BAD_TABLE 5113
48 | #define ER_X_BAD_PROJECTION 5114
49 | #define ER_X_DOC_ID_MISSING 5115
50 | #define ER_X_DOC_ID_DUPLICATE 5116
51 | #define ER_X_DOC_REQUIRED_FIELD_MISSING 5117
52 | #define ER_X_PROJ_BAD_KEY_NAME 5120
53 | #define ER_X_BAD_DOC_PATH 5121
54 | #define ER_X_CURSOR_EXISTS 5122
55 | #define ER_X_EXPR_BAD_OPERATOR 5150
56 | #define ER_X_EXPR_BAD_NUM_ARGS 5151
57 | #define ER_X_EXPR_MISSING_ARG 5152
58 | #define ER_X_EXPR_BAD_TYPE_VALUE 5153
59 | #define ER_X_EXPR_BAD_VALUE 5154
60 | #define ER_X_INVALID_COLLECTION 5156
61 | #define ER_X_INVALID_ADMIN_COMMAND 5157
62 | #define ER_X_EXPECT_NOT_OPEN 5158
63 | #define ER_X_EXPECT_FAILED 5159
64 | #define ER_X_EXPECT_BAD_CONDITION 5160
65 | #define ER_X_EXPECT_BAD_CONDITION_VALUE 5161
66 | #define ER_X_INVALID_NAMESPACE 5162
67 | #define ER_X_BAD_NOTICE 5163
68 | #define ER_X_CANNOT_DISABLE_NOTICE 5164
69 | #define ER_X_BAD_CONFIGURATION 5165
70 | #define ER_X_MYSQLX_ACCOUNT_MISSING_PERMISSIONS 5167
71 |
72 | #endif // _MYSQLX_ERROR_H_
73 |
--------------------------------------------------------------------------------
/vendor/mysql/include/mysqlx_version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016, 2023, Oracle and/or its affiliates.
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License, version 2.0,
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is also distributed with certain software (including
9 | * but not limited to OpenSSL) that is licensed under separate terms,
10 | * as designated in a particular file or component or in included license
11 | * documentation. The authors of MySQL hereby grant you an additional
12 | * permission to link the program and your derivative works with the
13 | * separately licensed software that they have included with MySQL.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License, version 2.0, for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program; if not, write to the Free Software
22 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 | * 02110-1301 USA
24 | */
25 |
26 | /* Version numbers for X Plugin */
27 |
28 | #ifndef _MYSQLX_VERSION_H_
29 | #define _MYSQLX_VERSION_H_
30 |
31 | #define MYSQLX_PLUGIN_VERSION_MAJOR 1
32 | #define MYSQLX_PLUGIN_VERSION_MINOR 0
33 | #define MYSQLX_PLUGIN_VERSION_PATCH 2
34 |
35 | #define MYSQLX_PLUGIN_NAME "mysqlx"
36 | #define MYSQLX_STATUS_VARIABLE_PREFIX(NAME) "Mysqlx_" NAME
37 | #define MYSQLX_SYSTEM_VARIABLE_PREFIX(NAME) "mysqlx_" NAME
38 |
39 | #define MYSQLX_TCP_PORT 33060U
40 | #define MYSQLX_UNIX_ADDR "/tmp/mysqlx.sock"
41 |
42 | #define MYSQLX_PLUGIN_VERSION ( (MYSQLX_PLUGIN_VERSION_MAJOR << 8) | MYSQLX_PLUGIN_VERSION_MINOR )
43 | #define MYSQLX_PLUGIN_VERSION_STRING "1.0.2"
44 |
45 | #endif // _MYSQLX_VERSION_H_
46 |
--------------------------------------------------------------------------------
/vendor/mysql/include/plugin_validate_password.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED
24 | #define MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED
25 |
26 | /* API for validate_password plugin. (MYSQL_VALIDATE_PASSWORD_PLUGIN) */
27 |
28 | #include
29 | #define MYSQL_VALIDATE_PASSWORD_INTERFACE_VERSION 0x0100
30 |
31 | /*
32 | The descriptor structure for the plugin, that is referred from
33 | st_mysql_plugin.
34 | */
35 |
36 | typedef void* mysql_string_handle;
37 |
38 | struct st_mysql_validate_password
39 | {
40 | int interface_version;
41 | /*
42 | This function retuns TRUE for passwords which satisfy the password
43 | policy (as choosen by plugin variable) and FALSE for all other
44 | password
45 | */
46 | int (*validate_password)(mysql_string_handle password);
47 | /*
48 | This function returns the password strength (0-100) depending
49 | upon the policies
50 | */
51 | int (*get_password_strength)(mysql_string_handle password);
52 | };
53 | #endif
54 |
--------------------------------------------------------------------------------
/vendor/mysql/include/sslopt-case.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
24 |
25 | #ifndef MYSQL_CLIENT
26 | #error This header is supposed to be used only in the client
27 | #endif
28 |
29 | case OPT_SSL_MODE:
30 | opt_ssl_mode= find_type_or_exit(argument, &ssl_mode_typelib,
31 | opt->name);
32 | ssl_mode_set_explicitly= TRUE;
33 | break;
34 | case OPT_SSL_SSL:
35 | CLIENT_WARN_DEPRECATED("--ssl", "--ssl-mode");
36 | if (!opt_use_ssl_arg)
37 | opt_ssl_mode= SSL_MODE_DISABLED;
38 | else if (opt_ssl_mode < SSL_MODE_REQUIRED)
39 | opt_ssl_mode= SSL_MODE_REQUIRED;
40 | break;
41 | case OPT_SSL_VERIFY_SERVER_CERT:
42 | CLIENT_WARN_DEPRECATED("--ssl-verify-server-cert",
43 | "--ssl-mode=VERIFY_IDENTITY");
44 | if (!opt_ssl_verify_server_cert_arg)
45 | {
46 | if (opt_ssl_mode >= SSL_MODE_VERIFY_IDENTITY)
47 | opt_ssl_mode= SSL_MODE_VERIFY_CA;
48 | }
49 | else
50 | opt_ssl_mode= SSL_MODE_VERIFY_IDENTITY;
51 | break;
52 | case OPT_SSL_CA:
53 | case OPT_SSL_CAPATH:
54 | /* Don't change ssl-mode if set explicitly. */
55 | if (!ssl_mode_set_explicitly)
56 | opt_ssl_mode= SSL_MODE_VERIFY_CA;
57 | break;
58 | case OPT_SSL_KEY:
59 | case OPT_SSL_CERT:
60 | case OPT_SSL_CIPHER:
61 | case OPT_SSL_CRL:
62 | case OPT_SSL_CRLPATH:
63 | case OPT_TLS_VERSION:
64 | break;
65 | #endif /* HAVE_OPENSSL */
66 |
--------------------------------------------------------------------------------
/vendor/mysql/include/sslopt-longopts.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
24 | #ifdef MYSQL_CLIENT
25 | {"ssl-mode", OPT_SSL_MODE,
26 | "SSL connection mode.",
27 | 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
28 | {"ssl", OPT_SSL_SSL,
29 | "Deprecated. Use --ssl-mode instead.",
30 | &opt_use_ssl_arg, &opt_use_ssl_arg, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
31 | {"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT,
32 | "Deprecated. Use --ssl-mode=VERIFY_IDENTITY instead.",
33 | &opt_ssl_verify_server_cert_arg, &opt_ssl_verify_server_cert_arg,
34 | 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
35 | #else
36 | {"ssl", OPT_SSL_SSL,
37 | "If set to ON, this option enforces that SSL is established before client "
38 | "attempts to authenticate to the server. To disable client SSL capabilities "
39 | "use --ssl=OFF.",
40 | &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
41 | #endif
42 | {"ssl-ca", OPT_SSL_CA,
43 | "CA file in PEM format.",
44 | &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
45 | 0, 0, 0, 0, 0, 0},
46 | {"ssl-capath", OPT_SSL_CAPATH,
47 | "CA directory.",
48 | &opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
49 | 0, 0, 0, 0, 0, 0},
50 | {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format.",
51 | &opt_ssl_cert, &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
52 | 0, 0, 0, 0, 0, 0},
53 | {"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use.",
54 | &opt_ssl_cipher, &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
55 | 0, 0, 0, 0, 0, 0},
56 | {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format.",
57 | &opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
58 | 0, 0, 0, 0, 0, 0},
59 | {"ssl-crl", OPT_SSL_CRL, "Certificate revocation list.",
60 | &opt_ssl_crl, &opt_ssl_crl, 0, GET_STR, REQUIRED_ARG,
61 | 0, 0, 0, 0, 0, 0},
62 | {"ssl-crlpath", OPT_SSL_CRLPATH,
63 | "Certificate revocation list path.",
64 | &opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG,
65 | 0, 0, 0, 0, 0, 0},
66 | {"tls-version", OPT_TLS_VERSION, "TLS version to use, "
67 | "permitted values are: TLSv1, TLSv1.1, TLSv1.2",
68 | &opt_tls_version, &opt_tls_version, 0, GET_STR, REQUIRED_ARG,
69 | 0, 0, 0, 0, 0, 0},
70 | #endif /* HAVE_OPENSSL */
71 |
--------------------------------------------------------------------------------
/vendor/mysql/include/sslopt-vars.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License, version 2.0, for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program; if not, write to the Free Software
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 |
23 | #ifndef SSLOPT_VARS_INCLUDED
24 | #define SSLOPT_VARS_INCLUDED
25 |
26 | #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
27 |
28 | #ifndef MYSQL_CLIENT
29 | #error This header is supposed to be used only in the client
30 | #endif
31 |
32 | const char *ssl_mode_names_lib[] =
33 | {"DISABLED", "PREFERRED", "REQUIRED", "VERIFY_CA", "VERIFY_IDENTITY",
34 | NullS };
35 | TYPELIB ssl_mode_typelib = {array_elements(ssl_mode_names_lib) - 1, "",
36 | ssl_mode_names_lib, NULL};
37 |
38 | static uint opt_ssl_mode = SSL_MODE_PREFERRED;
39 | static char *opt_ssl_ca = 0;
40 | static char *opt_ssl_capath = 0;
41 | static char *opt_ssl_cert = 0;
42 | static char *opt_ssl_cipher = 0;
43 | static char *opt_ssl_key = 0;
44 | static char *opt_ssl_crl = 0;
45 | static char *opt_ssl_crlpath = 0;
46 | static char *opt_tls_version = 0;
47 | static my_bool ssl_mode_set_explicitly= FALSE;
48 | static my_bool opt_use_ssl_arg= TRUE;
49 | static my_bool opt_ssl_verify_server_cert_arg= FALSE;
50 |
51 | static void set_client_ssl_options(MYSQL *mysql)
52 | {
53 | /*
54 | Print a warning if explicitly defined combination of --ssl-mode other than
55 | VERIFY_CA or VERIFY_IDENTITY with explicit --ssl-ca or --ssl-capath values.
56 | */
57 | if (ssl_mode_set_explicitly &&
58 | opt_ssl_mode < SSL_MODE_VERIFY_CA &&
59 | (opt_ssl_ca || opt_ssl_capath))
60 | {
61 | fprintf(stderr, "WARNING: no verification of server certificate will be done. "
62 | "Use --ssl-mode=VERIFY_CA or VERIFY_IDENTITY.\n");
63 | }
64 |
65 | /* Set SSL parameters: key, cert, ca, capath, cipher, clr, clrpath. */
66 | if (opt_ssl_mode >= SSL_MODE_VERIFY_CA)
67 | mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
68 | opt_ssl_capath, opt_ssl_cipher);
69 | else
70 | mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, NULL,
71 | NULL, opt_ssl_cipher);
72 | mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
73 | mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath);
74 | mysql_options(mysql, MYSQL_OPT_TLS_VERSION, opt_tls_version);
75 | mysql_options(mysql, MYSQL_OPT_SSL_MODE, &opt_ssl_mode);
76 | }
77 |
78 | #define SSL_SET_OPTIONS(mysql) set_client_ssl_options(mysql);
79 | #else
80 | #define SSL_SET_OPTIONS(mysql) do { } while(0)
81 | #endif
82 | #endif /* SSLOPT_VARS_INCLUDED */
83 |
--------------------------------------------------------------------------------
/vendor/mysql/include/typelib.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License, version 2.0,
5 | as published by the Free Software Foundation.
6 |
7 | This program is also distributed with certain software (including
8 | but not limited to OpenSSL) that is licensed under separate terms,
9 | as designated in a particular file or component or in included license
10 | documentation. The authors of MySQL hereby grant you an additional
11 | permission to link the program and your derivative works with the
12 | separately licensed software that they have included with MySQL.
13 |
14 | Without limiting anything contained in the foregoing, this file,
15 | which is part of C Driver for MySQL (Connector/C), is also subject to the
16 | Universal FOSS Exception, version 1.0, a copy of which can be found at
17 | http://oss.oracle.com/licenses/universal-foss-exception.
18 |
19 | This program is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU General Public License, version 2.0, for more details.
23 |
24 | You should have received a copy of the GNU General Public License
25 | along with this program; if not, write to the Free Software
26 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
27 |
28 |
29 | #ifndef _typelib_h
30 | #define _typelib_h
31 |
32 | #include "my_alloc.h"
33 |
34 | typedef struct st_typelib { /* Different types saved here */
35 | unsigned int count; /* How many types */
36 | const char *name; /* Name of typelib */
37 | const char **type_names;
38 | unsigned int *type_lengths;
39 | } TYPELIB;
40 |
41 | extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
42 | extern int find_type_or_exit(const char *x, TYPELIB *typelib,
43 | const char *option);
44 | #define FIND_TYPE_BASIC 0
45 | /** makes @c find_type() require the whole name, no prefix */
46 | #define FIND_TYPE_NO_PREFIX (1 << 0)
47 | /** always implicitely on, so unused, but old code may pass it */
48 | #define FIND_TYPE_NO_OVERWRITE (1 << 1)
49 | /** makes @c find_type() accept a number */
50 | #define FIND_TYPE_ALLOW_NUMBER (1 << 2)
51 | /** makes @c find_type() treat ',' as terminator */
52 | #define FIND_TYPE_COMMA_TERM (1 << 3)
53 |
54 | extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
55 | extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
56 | extern const char *get_type(TYPELIB *typelib,unsigned int nr);
57 | extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
58 |
59 | extern TYPELIB sql_protocol_typelib;
60 |
61 | my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name,
62 | my_ulonglong cur_set, my_ulonglong default_set,
63 | const char *str, unsigned int length,
64 | char **err_pos, unsigned int *err_len);
65 |
66 | #endif /* _typelib_h */
67 |
--------------------------------------------------------------------------------
/vendor/mysql/lib/mysqlclient.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Poggicek/mysql_mm/34af4db8f6eecb85a591024d0d49d1ce3ead362c/vendor/mysql/lib/mysqlclient.lib
--------------------------------------------------------------------------------